dmusic: Lock/unlock the module only on creation/destruction of the object (2nd try)
Michael Stefaniuc
mstefani at redhat.de
Sat May 31 13:12:31 CDT 2014
---
Just rebased on top of the stuff I have already send as there is more that
I need to send...
dlls/dmusic/collection.c | 9 ++++-----
dlls/dmusic/download.c | 10 +++++-----
dlls/dmusic/port.c | 6 ++----
3 files changed, 11 insertions(+), 14 deletions(-)
diff --git a/dlls/dmusic/collection.c b/dlls/dmusic/collection.c
index 3d09815..2c826f5 100644
--- a/dlls/dmusic/collection.c
+++ b/dlls/dmusic/collection.c
@@ -92,8 +92,6 @@ static ULONG WINAPI IDirectMusicCollectionImpl_IDirectMusicCollection_AddRef(LPD
TRACE("(%p/%p)->(): new ref = %u\n", iface, This, ref);
- DMUSIC_LockModule();
-
return ref;
}
@@ -104,10 +102,10 @@ static ULONG WINAPI IDirectMusicCollectionImpl_IDirectMusicCollection_Release(LP
TRACE("(%p/%p)->(): new ref = %u\n", iface, This, ref);
- if (!ref)
+ if (!ref) {
HeapFree(GetProcessHeap(), 0, This);
-
- DMUSIC_UnlockModule();
+ DMUSIC_UnlockModule();
+ }
return ref;
}
@@ -851,6 +849,7 @@ HRESULT WINAPI DMUSIC_CreateDirectMusicCollectionImpl(LPCGUID lpcGUID, LPVOID* p
obj->ref = 1;
list_init (&obj->Instruments);
+ DMUSIC_LockModule();
hr = IDirectMusicCollection_QueryInterface(&obj->IDirectMusicCollection_iface, lpcGUID, ppobj);
IDirectMusicCollection_Release(&obj->IDirectMusicCollection_iface);
diff --git a/dlls/dmusic/download.c b/dlls/dmusic/download.c
index cc2b024..a88ec2c 100644
--- a/dlls/dmusic/download.c
+++ b/dlls/dmusic/download.c
@@ -52,8 +52,6 @@ static ULONG WINAPI IDirectMusicDownloadImpl_AddRef(IDirectMusicDownload *iface)
TRACE("(%p)->(): new ref = %u\n", iface, ref);
- DMUSIC_LockModule();
-
return ref;
}
@@ -64,10 +62,10 @@ static ULONG WINAPI IDirectMusicDownloadImpl_Release(IDirectMusicDownload *iface
TRACE("(%p)->(): new ref = %u\n", iface, ref);
- if (!ref)
+ if (!ref) {
HeapFree(GetProcessHeap(), 0, This);
-
- DMUSIC_UnlockModule();
+ DMUSIC_UnlockModule();
+ }
return ref;
}
@@ -102,5 +100,7 @@ HRESULT DMUSIC_CreateDirectMusicDownloadImpl(const GUID *guid, void **ret_iface,
download->IDirectMusicDownload_iface.lpVtbl = &DirectMusicDownload_Vtbl;
download->ref = 1;
*ret_iface = download;
+
+ DMUSIC_LockModule();
return S_OK;
}
diff --git a/dlls/dmusic/port.c b/dlls/dmusic/port.c
index 9d42667..ad61ba5 100644
--- a/dlls/dmusic/port.c
+++ b/dlls/dmusic/port.c
@@ -70,8 +70,6 @@ static ULONG WINAPI IDirectMusicDownloadedInstrumentImpl_AddRef(LPDIRECTMUSICDOW
TRACE("(%p)->(): new ref = %u\n", iface, ref);
- DMUSIC_LockModule();
-
return ref;
}
@@ -86,10 +84,9 @@ static ULONG WINAPI IDirectMusicDownloadedInstrumentImpl_Release(LPDIRECTMUSICDO
{
HeapFree(GetProcessHeap(), 0, This->data);
HeapFree(GetProcessHeap(), 0, This);
+ DMUSIC_UnlockModule();
}
- DMUSIC_UnlockModule();
-
return ref;
}
@@ -123,6 +120,7 @@ static HRESULT DMUSIC_CreateDirectMusicDownloadedInstrumentImpl(IDirectMusicDown
object->ref = 1;
*instrument = &object->IDirectMusicDownloadedInstrument_iface;
+ DMUSIC_LockModule();
return S_OK;
}
--
1.8.3.1
More information about the wine-patches
mailing list