general question..

Chris Ahrendt celticht32 at
Tue Jul 22 15:23:01 CDT 2008

Vitaliy Margolen wrote:
> 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?
ok it was late when I was writing this =)

the glCtx and the leave critical section can be moved back into the main 
routine.. the hdc and hwnd are globals so thats not a problem...
next question is does the hdc and hwnd memory allocation get freed in 
the releaseDC and destroy window calls before the nulls?


More information about the wine-devel mailing list