Francois Gouget : winmm: Give a name to the critical sections, make them static and delete them when unloading the dll.
Alexandre Julliard
julliard at winehq.org
Tue Nov 15 13:17:34 CST 2011
Module: wine
Branch: master
Commit: 814c854fd26ea4f8b9ffea30ea4db1533a820d27
URL: http://source.winehq.org/git/wine.git/?a=commit;h=814c854fd26ea4f8b9ffea30ea4db1533a820d27
Author: Francois Gouget <fgouget at codeweavers.com>
Date: Tue Nov 15 14:40:30 2011 +0100
winmm: Give a name to the critical sections, make them static and delete them when unloading the dll.
---
dlls/winmm/waveform.c | 16 +++++++++++++---
dlls/winmm/winemm.h | 2 +-
dlls/winmm/winmm.c | 5 ++---
3 files changed, 16 insertions(+), 7 deletions(-)
diff --git a/dlls/winmm/waveform.c b/dlls/winmm/waveform.c
index 05641a6..041b63f 100644
--- a/dlls/winmm/waveform.c
+++ b/dlls/winmm/waveform.c
@@ -140,6 +140,13 @@ static UINT g_inmmdevices_count;
static IMMDeviceEnumerator *g_devenum;
static CRITICAL_SECTION g_devthread_lock;
+static CRITICAL_SECTION_DEBUG g_devthread_lock_debug =
+{
+ 0, 0, &g_devthread_lock,
+ { &g_devthread_lock_debug.ProcessLocksList, &g_devthread_lock_debug.ProcessLocksList },
+ 0, 0, { (DWORD_PTR)(__FILE__ ": g_devthread_lock") }
+};
+static CRITICAL_SECTION g_devthread_lock = { &g_devthread_lock_debug, -1, 0, 0, 0, 0 };
static HANDLE g_devices_thread;
static HWND g_devices_hwnd;
@@ -167,10 +174,10 @@ static LRESULT WOD_Close(HWAVEOUT hwave);
static LRESULT WID_Open(WINMM_OpenInfo *info);
static LRESULT WID_Close(HWAVEIN hwave);
-BOOL WINMM_InitWaveform(void)
+void WINMM_DeleteWaveform(void)
{
- InitializeCriticalSection(&g_devthread_lock);
- return TRUE;
+ /* FIXME: Free g_(in,out)_mmdevices? */
+ DeleteCriticalSection(&g_devthread_lock);
}
static inline HWAVE WINMM_MakeHWAVE(UINT mmdevice, BOOL is_out, UINT device)
@@ -193,6 +200,8 @@ static void WINMM_InitDevice(WINMM_Device *device,
WINMM_MMDevice *parent, HWAVE hwave)
{
InitializeCriticalSection(&device->lock);
+ device->lock.DebugInfo->Spare[0] = (DWORD_PTR)(__FILE__ ": WINMM_Device.lock");
+
device->handle = hwave;
device->parent = parent;
}
@@ -449,6 +458,7 @@ static HRESULT WINMM_InitMMDevice(EDataFlow flow, IMMDevice *device,
CoCreateGuid(&dev->session);
InitializeCriticalSection(&dev->lock);
+ dev->lock.DebugInfo->Spare[0] = (DWORD_PTR)(__FILE__ ": WINMM_Device.lock");
return S_OK;
}
diff --git a/dlls/winmm/winemm.h b/dlls/winmm/winemm.h
index 114811c..93c2627 100644
--- a/dlls/winmm/winemm.h
+++ b/dlls/winmm/winemm.h
@@ -152,7 +152,7 @@ void TIME_MMTimeStop(void) DECLSPEC_HIDDEN;
MMRESULT WINMM_CheckCallback(DWORD_PTR dwCallback, DWORD fdwOpen, BOOL mixer) DECLSPEC_HIDDEN;
-BOOL WINMM_InitWaveform(void) DECLSPEC_HIDDEN;
+void WINMM_DeleteWaveform(void) DECLSPEC_HIDDEN;
/* Global variables */
extern CRITICAL_SECTION WINMM_cs DECLSPEC_HIDDEN;
diff --git a/dlls/winmm/winmm.c b/dlls/winmm/winmm.c
index a77d448..6115838 100644
--- a/dlls/winmm/winmm.c
+++ b/dlls/winmm/winmm.c
@@ -79,7 +79,7 @@ static BOOL WINMM_CreateIData(HINSTANCE hInstDLL)
{
hWinMM32Instance = hInstDLL;
psLastEvent = CreateEventW(NULL, TRUE, FALSE, NULL);
- return WINMM_InitWaveform();
+ return TRUE;
}
/**************************************************************************
@@ -89,8 +89,7 @@ static void WINMM_DeleteIData(void)
{
TIME_MMTimeStop();
- /* FIXME: should also free content and resources allocated
- * inside WINMM_IData */
+ WINMM_DeleteWaveform();
CloseHandle(psLastEvent);
DeleteCriticalSection(&WINMM_cs);
}
More information about the wine-cvs
mailing list