general question..

Vitaliy Margolen wine-devel at
Tue Jul 22 00:04:03 CDT 2008

Chris Ahrendt wrote:
>    fail:
>      if(wined3d_fake_gl_context_hdc)
>          ReleaseDC(wined3d_fake_gl_context_hwnd, 
> wined3d_fake_gl_context_hdc);
>      wined3d_fake_gl_context_hdc = NULL;
>      if(wined3d_fake_gl_context_hwnd)
>          DestroyWindow(wined3d_fake_gl_context_hwnd);
>      wined3d_fake_gl_context_hwnd = NULL;
>      if(glCtx) pwglDeleteContext(glCtx);
>      LeaveCriticalSection(&wined3d_fake_gl_context_cs);
>      return FALSE;
> into a routine and then do a
> return fakeContextFail(glCtx);

That will turn into nightmare when tracking a locking problem down. Call to 
LeaveCriticalSection should always be in the same function as 
EnterCriticalSection. Same applies to any resource that you do not want to 
leak. That is much more important then calling a function a "routine" and 
replacing all goto's with that function call.

Also I'd like to show how you can free local variables?

More information about the wine-devel mailing list