On Tue, 19 Jun 2012, Erik van Pienbroek wrote:
[...]
> Additionally a check is added to make sure no recursive loop is 
> triggered when the native file association database points back to 
> wine and the fallback path is triggered again

This looks much better.


[...]
> @@ -1911,6 +1944,44 @@ static BOOL SHELL_execute( LPSHELLEXECUTEINFOW sei, 
> SHELL_ExecuteW32 execfunc )
>          strcatW(lpstrTmpFile, lpFile);
>          retval = (UINT_PTR)ShellExecuteW(sei_tmp.hwnd, sei_tmp.lpVerb, 
> lpstrTmpFile, NULL, NULL, 0);
>      }
> +#if defined(HAVE_FORK) && defined(HAVE_WAITPID)
> +    /* Integration with native file association database */
> +    else if (!getenv("WINE_INSIDE_SHELLEXECUTE"))
> +    {
[...]
> +        /* Prevent the situation where the native file association database
> +         * tries to run wine to execute a program and we trigger this 
> fallback
> +         * path again and end up in a recursive loop */
> +        setenv("WINE_INSIDE_SHELLEXECUTE", "1", 0);
[...]
+        unsetenv("WINE_INSIDE_SHELLEXECUTE");

Setting WINE_INSIDE_SHELLEXECUTE here creates a race condition if two 
threads call ShellExecute() at the same time. So I think this should be 
set between the fork() and the exec() in SHELL_try_native_execute().

-- 
Francois Gouget <fgou...@codeweavers.com>


Reply via email to