Commit b2bb57a4 authored by Paul Vriens's avatar Paul Vriens Committed by Alexandre Julliard

- use Interlocked* functions in AddRef and Release.

- store the result of the Interlocked functions and use only this.
parent 1bc887bc
......@@ -54,17 +54,20 @@ HRESULT WINAPI IDirectMusicChordMapImpl_IUnknown_QueryInterface (LPUNKNOWN iface
ULONG WINAPI IDirectMusicChordMapImpl_IUnknown_AddRef (LPUNKNOWN iface) {
ICOM_THIS_MULTI(IDirectMusicChordMapImpl, UnknownVtbl, iface);
TRACE("(%p): AddRef from %ld\n", This, This->ref);
ULONG ref = InterlockedIncrement(&This->ref);
TRACE("(%p): AddRef from %ld\n", This, ref - 1);
DMCOMPOS_LockModule();
return ++(This->ref);
return ref;
}
ULONG WINAPI IDirectMusicChordMapImpl_IUnknown_Release (LPUNKNOWN iface) {
ICOM_THIS_MULTI(IDirectMusicChordMapImpl, UnknownVtbl, iface);
ULONG ref = --This->ref;
TRACE("(%p): ReleaseRef to %ld\n", This, This->ref);
ULONG ref = InterlockedDecrement(&This->ref);
TRACE("(%p): ReleaseRef to %ld\n", This, ref);
if (ref == 0) {
HeapFree(GetProcessHeap(), 0, This);
......
......@@ -51,17 +51,20 @@ HRESULT WINAPI IDirectMusicChordMapTrack_IUnknown_QueryInterface (LPUNKNOWN ifac
ULONG WINAPI IDirectMusicChordMapTrack_IUnknown_AddRef (LPUNKNOWN iface) {
ICOM_THIS_MULTI(IDirectMusicChordMapTrack, UnknownVtbl, iface);
TRACE("(%p): AddRef from %ld\n", This, This->ref);
ULONG ref = InterlockedIncrement(&This->ref);
TRACE("(%p): AddRef from %ld\n", This, ref - 1);
DMCOMPOS_LockModule();
return ++(This->ref);
return ref;
}
ULONG WINAPI IDirectMusicChordMapTrack_IUnknown_Release (LPUNKNOWN iface) {
ICOM_THIS_MULTI(IDirectMusicChordMapTrack, UnknownVtbl, iface);
ULONG ref = --This->ref;
TRACE("(%p): ReleaseRef to %ld\n", This, This->ref);
ULONG ref = InterlockedDecrement(&This->ref);
TRACE("(%p): ReleaseRef to %ld\n", This, ref);
if (ref == 0) {
HeapFree(GetProcessHeap(), 0, This);
......
......@@ -38,17 +38,20 @@ HRESULT WINAPI IDirectMusicComposerImpl_QueryInterface (LPDIRECTMUSICCOMPOSER if
ULONG WINAPI IDirectMusicComposerImpl_AddRef (LPDIRECTMUSICCOMPOSER iface) {
IDirectMusicComposerImpl *This = (IDirectMusicComposerImpl *)iface;
TRACE("(%p): AddRef from %ld\n", This, This->ref);
ULONG ref = InterlockedIncrement(&This->ref);
TRACE("(%p): AddRef from %ld\n", This, ref - 1);
DMCOMPOS_LockModule();
return ++(This->ref);
return ref;
}
ULONG WINAPI IDirectMusicComposerImpl_Release (LPDIRECTMUSICCOMPOSER iface) {
IDirectMusicComposerImpl *This = (IDirectMusicComposerImpl *)iface;
ULONG ref = --This->ref;
TRACE("(%p): ReleaseRef to %ld\n", This, This->ref);
ULONG ref = InterlockedDecrement(&This->ref);
TRACE("(%p): ReleaseRef to %ld\n", This, ref);
if (ref == 0) {
HeapFree(GetProcessHeap(), 0, This);
......
......@@ -51,17 +51,20 @@ HRESULT WINAPI IDirectMusicSignPostTrack_IUnknown_QueryInterface (LPUNKNOWN ifac
ULONG WINAPI IDirectMusicSignPostTrack_IUnknown_AddRef (LPUNKNOWN iface) {
ICOM_THIS_MULTI(IDirectMusicSignPostTrack, UnknownVtbl, iface);
TRACE("(%p): AddRef from %ld\n", This, This->ref);
ULONG ref = InterlockedIncrement(&This->ref);
TRACE("(%p): AddRef from %ld\n", This, ref - 1);
DMCOMPOS_LockModule();
return ++(This->ref);
return ref;
}
ULONG WINAPI IDirectMusicSignPostTrack_IUnknown_Release (LPUNKNOWN iface) {
ICOM_THIS_MULTI(IDirectMusicSignPostTrack, UnknownVtbl, iface);
ULONG ref = --This->ref;
TRACE("(%p): ReleaseRef to %ld\n", This, This->ref);
ULONG ref = InterlockedDecrement(&This->ref);
TRACE("(%p): ReleaseRef to %ld\n", This, ref);
if (ref == 0) {
HeapFree(GetProcessHeap(), 0, This);
......
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