Commit 1a7c0a6a authored by Michael Stefaniuc's avatar Michael Stefaniuc Committed by Alexandre Julliard

dmusic: Lock/unlock the module only on creation/destruction of the object.

parent d67f35b9
......@@ -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);
......
......@@ -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;
}
......@@ -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;
}
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment