DDraw: Protect the ddraw object list

Mike McCormack mike at codeweavers.com
Fri Oct 6 01:42:46 CDT 2006


Stefan Dösinger wrote:

> @@ -851,6 +853,13 @@ DllMain(HINSTANCE hInstDLL,

> +        /* Initialize the ddraw object list critical section unconditionally
> +         * Even if the app doesn't use multithreaded ddraw objects it can still
> +         * use multiple ddraw objects in multiple threads
> +         * Well, initialize it only once
> +         */
> +        if(counter == 0) InitializeCriticalSection(&listCrit);
> +

Isn't "counter" redundant?  When DllMain is called, the loader lock is 
held.  Furthermore, DllMain( ... DLL_PROCESS_ATTACH) is only called once 
per process, so counter should only ever be 1 after a DLL_PROCESS_ATTACH 
and 0 after a DETACH.

Mike



More information about the wine-devel mailing list