Module: wine Branch: master Commit: 096bfbd2143b07ca68441a7d8f722d38ce2dc3b2 URL: http://source.winehq.org/git/wine.git/?a=commit;h=096bfbd2143b07ca68441a7d8f...
Author: Michael Stefaniuc mstefani@redhat.de Date: Sat May 31 19:21:33 2014 +0200
dmusic: Simplify the creation of a DirectMusic8 object.
Also lock/unlock the module only on creation/destruction of the object.
---
dlls/dmusic/dmusic.c | 20 +++++++------------- 1 file changed, 7 insertions(+), 13 deletions(-)
diff --git a/dlls/dmusic/dmusic.c b/dlls/dmusic/dmusic.c index 30f69cc..28be851 100644 --- a/dlls/dmusic/dmusic.c +++ b/dlls/dmusic/dmusic.c @@ -61,8 +61,6 @@ static ULONG WINAPI IDirectMusic8Impl_AddRef(LPDIRECTMUSIC8 iface)
TRACE("(%p)->(): new ref = %u\n", This, ref);
- DMUSIC_LockModule(); - return ref; }
@@ -78,10 +76,9 @@ static ULONG WINAPI IDirectMusic8Impl_Release(LPDIRECTMUSIC8 iface) HeapFree(GetProcessHeap(), 0, This->system_ports); HeapFree(GetProcessHeap(), 0, This->ppPorts); HeapFree(GetProcessHeap(), 0, This); + DMUSIC_UnlockModule(); }
- DMUSIC_UnlockModule(); - return ref; }
@@ -417,7 +414,7 @@ HRESULT WINAPI DMUSIC_CreateDirectMusicImpl(LPCGUID riid, LPVOID* ret_iface, LPU return E_OUTOFMEMORY;
dmusic->IDirectMusic8_iface.lpVtbl = &DirectMusic8_Vtbl; - dmusic->ref = 0; /* Will be inited by QueryInterface */ + dmusic->ref = 1; dmusic->pMasterClock = NULL; dmusic->ppPorts = NULL; dmusic->nrofports = 0; @@ -427,14 +424,11 @@ HRESULT WINAPI DMUSIC_CreateDirectMusicImpl(LPCGUID riid, LPVOID* ret_iface, LPU return ret; }
- ret = IDirectMusic8Impl_QueryInterface(&dmusic->IDirectMusic8_iface, riid, ret_iface); - if (FAILED(ret)) { - IReferenceClock_Release(&dmusic->pMasterClock->IReferenceClock_iface); - HeapFree(GetProcessHeap(), 0, dmusic); - return ret; - } - create_system_ports_list(dmusic);
- return S_OK; + DMUSIC_LockModule(); + ret = IDirectMusic8Impl_QueryInterface(&dmusic->IDirectMusic8_iface, riid, ret_iface); + IDirectMusic8Impl_Release(&dmusic->IDirectMusic8_iface); + + return ret; }