Commit 1fd94250 authored by James Hawkins's avatar James Hawkins Committed by Alexandre Julliard

Properly implement DllCanUnloadNow ref counting.

parent eae60bed
......@@ -55,6 +55,8 @@ ULONG WINAPI IDirectMusicAuditionTrack_IUnknown_AddRef (LPUNKNOWN iface) {
TRACE("(%p): AddRef from %ld\n", This, ref - 1);
DMSTYLE_LockModule();
return ref;
}
......@@ -67,6 +69,9 @@ ULONG WINAPI IDirectMusicAuditionTrack_IUnknown_Release (LPUNKNOWN iface) {
if (ref == 0) {
HeapFree(GetProcessHeap(), 0, This);
}
DMSTYLE_UnlockModule();
return ref;
}
......
......@@ -56,6 +56,8 @@ ULONG WINAPI IDirectMusicChordTrack_IUnknown_AddRef (LPUNKNOWN iface) {
TRACE("(%p): AddRef from %ld\n", This, ref - 1);
DMSTYLE_LockModule();
return ref;
}
......@@ -68,6 +70,9 @@ ULONG WINAPI IDirectMusicChordTrack_IUnknown_Release (LPUNKNOWN iface) {
if (ref == 0) {
HeapFree(GetProcessHeap(), 0, This);
}
DMSTYLE_UnlockModule();
return ref;
}
......
......@@ -55,6 +55,8 @@ ULONG WINAPI IDirectMusicCommandTrack_IUnknown_AddRef (LPUNKNOWN iface) {
TRACE("(%p): AddRef from %ld\n", This, ref - 1);
DMSTYLE_LockModule();
return ref;
}
......@@ -67,6 +69,9 @@ ULONG WINAPI IDirectMusicCommandTrack_IUnknown_Release (LPUNKNOWN iface) {
if (ref == 0) {
HeapFree(GetProcessHeap(), 0, This);
}
DMSTYLE_UnlockModule();
return ref;
}
......
......@@ -539,6 +539,12 @@ extern HRESULT WINAPI IDirectMusicStyleTrack_IPersistStream_Load (LPPERSISTSTREA
extern HRESULT WINAPI IDirectMusicStyleTrack_IPersistStream_Save (LPPERSISTSTREAM iface, IStream* pStm, BOOL fClearDirty);
extern HRESULT WINAPI IDirectMusicStyleTrack_IPersistStream_GetSizeMax (LPPERSISTSTREAM iface, ULARGE_INTEGER* pcbSize);
/**********************************************************************
* Dll lifetime tracking declaration for dmstyle.dll
*/
extern LONG DMSTYLE_refCount;
static inline void DMSTYLE_LockModule() { InterlockedIncrement( &DMSTYLE_refCount ); }
static inline void DMSTYLE_UnlockModule() { InterlockedDecrement( &DMSTYLE_refCount ); }
/*****************************************************************************
* Misc.
......
......@@ -55,6 +55,8 @@ ULONG WINAPI IDirectMusicMotifTrack_IUnknown_AddRef (LPUNKNOWN iface) {
TRACE("(%p): AddRef from %ld\n", This, ref - 1);
DMSTYLE_LockModule();
return ref;
}
......@@ -67,6 +69,9 @@ ULONG WINAPI IDirectMusicMotifTrack_IUnknown_Release (LPUNKNOWN iface) {
if (ref == 0) {
HeapFree(GetProcessHeap(), 0, This);
}
DMSTYLE_UnlockModule();
return ref;
}
......
......@@ -55,6 +55,8 @@ ULONG WINAPI IDirectMusicMuteTrack_IUnknown_AddRef (LPUNKNOWN iface) {
TRACE("(%p): AddRef from %ld\n", This, ref - 1);
DMSTYLE_LockModule();
return ref;
}
......@@ -67,6 +69,9 @@ ULONG WINAPI IDirectMusicMuteTrack_IUnknown_Release (LPUNKNOWN iface) {
if (ref == 0) {
HeapFree(GetProcessHeap(), 0, This);
}
DMSTYLE_UnlockModule();
return ref;
}
......
......@@ -63,6 +63,8 @@ ULONG WINAPI IDirectMusicStyle8Impl_IUnknown_AddRef (LPUNKNOWN iface) {
TRACE("(%p): AddRef from %ld\n", This, ref - 1);
DMSTYLE_LockModule();
return ref;
}
......@@ -75,6 +77,9 @@ ULONG WINAPI IDirectMusicStyle8Impl_IUnknown_Release (LPUNKNOWN iface) {
if (ref == 0) {
HeapFree(GetProcessHeap(), 0, This);
}
DMSTYLE_UnlockModule();
return ref;
}
......
......@@ -55,6 +55,8 @@ ULONG WINAPI IDirectMusicStyleTrack_IUnknown_AddRef (LPUNKNOWN iface) {
TRACE("(%p): AddRef from %ld\n", This, ref - 1);
DMSTYLE_LockModule();
return ref;
}
......@@ -67,6 +69,9 @@ ULONG WINAPI IDirectMusicStyleTrack_IUnknown_Release (LPUNKNOWN iface) {
if (ref == 0) {
HeapFree(GetProcessHeap(), 0, This);
}
DMSTYLE_UnlockModule();
return ref;
}
......
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