winealsa.drv: Delete the g_sessions_lock critical section when unloading the dll.

Francois Gouget fgouget at codeweavers.com
Mon Nov 7 09:52:40 CST 2011


---

I have not seen anything that would prevent this dll from being unloaded 
so I think it's better to clean up on unload.

 dlls/winealsa.drv/mmdevdrv.c |   11 +++++++++--
 1 files changed, 9 insertions(+), 2 deletions(-)

diff --git a/dlls/winealsa.drv/mmdevdrv.c b/dlls/winealsa.drv/mmdevdrv.c
index 25693c0..bc1ca94 100644
--- a/dlls/winealsa.drv/mmdevdrv.c
+++ b/dlls/winealsa.drv/mmdevdrv.c
@@ -219,12 +219,19 @@ static inline SessionMgr *impl_from_IAudioSessionManager2(IAudioSessionManager2
 
 BOOL WINAPI DllMain(HINSTANCE dll, DWORD reason, void *reserved)
 {
-    if(reason == DLL_PROCESS_ATTACH){
+    switch (reason)
+    {
+    case DLL_PROCESS_ATTACH:
         g_timer_q = CreateTimerQueue();
         if(!g_timer_q)
             return FALSE;
-    }
+        break;
 
+    case DLL_PROCESS_DETACH:
+        g_sessions_lock.DebugInfo->Spare[0] = 0;
+        DeleteCriticalSection(&g_sessions_lock);
+        break;
+    }
     return TRUE;
 }
 
-- 
1.7.7.1




More information about the wine-patches mailing list