Removed printing of thread id for AddRef and Release because

WINEDEBUG=+tid gives the same result.
General consistency cleanup.
This commit is contained in:
Robert Reif 2005-02-11 11:49:05 +00:00 committed by Alexandre Julliard
parent 14f9b844ce
commit f8833daef1
7 changed files with 219 additions and 225 deletions

View File

@ -54,25 +54,25 @@ static HRESULT WINAPI IDirectSoundNotifyImpl_QueryInterface(
static ULONG WINAPI IDirectSoundNotifyImpl_AddRef(LPDIRECTSOUNDNOTIFY iface) static ULONG WINAPI IDirectSoundNotifyImpl_AddRef(LPDIRECTSOUNDNOTIFY iface)
{ {
IDirectSoundNotifyImpl *This = (IDirectSoundNotifyImpl *)iface; IDirectSoundNotifyImpl *This = (IDirectSoundNotifyImpl *)iface;
TRACE("(%p) ref was %ld, thread is %04lx\n",This, This->ref, GetCurrentThreadId()); ULONG ref = InterlockedIncrement(&(This->ref));
return InterlockedIncrement(&(This->ref)); TRACE("(%p) ref was %ld\n", This, ref - 1);
return ref;
} }
static ULONG WINAPI IDirectSoundNotifyImpl_Release(LPDIRECTSOUNDNOTIFY iface) { static ULONG WINAPI IDirectSoundNotifyImpl_Release(LPDIRECTSOUNDNOTIFY iface)
IDirectSoundNotifyImpl *This = (IDirectSoundNotifyImpl *)iface; {
ULONG ref; IDirectSoundNotifyImpl *This = (IDirectSoundNotifyImpl *)iface;
ULONG ref = InterlockedDecrement(&(This->ref));
TRACE("(%p) ref was %ld\n", This, ref + 1);
TRACE("(%p) ref was %ld, thread is %04lx\n",This, This->ref, GetCurrentThreadId()); if (!ref) {
IDirectSoundBuffer_Release((LPDIRECTSOUNDBUFFER)This->dsb);
ref = InterlockedDecrement(&(This->ref)); This->dsb->notify = NULL;
if (ref == 0) { HeapFree(GetProcessHeap(), 0, This);
IDirectSoundBuffer_Release((LPDIRECTSOUNDBUFFER)This->dsb); TRACE("(%p) released\n", This);
This->dsb->notify = NULL; }
HeapFree(GetProcessHeap(),0,This); return ref;
TRACE("(%p) released\n",This);
}
return ref;
} }
static HRESULT WINAPI IDirectSoundNotifyImpl_SetNotificationPositions( static HRESULT WINAPI IDirectSoundNotifyImpl_SetNotificationPositions(
@ -350,22 +350,19 @@ static HRESULT WINAPI IDirectSoundBufferImpl_Stop(LPDIRECTSOUNDBUFFER8 iface)
static ULONG WINAPI IDirectSoundBufferImpl_AddRef(LPDIRECTSOUNDBUFFER8 iface) static ULONG WINAPI IDirectSoundBufferImpl_AddRef(LPDIRECTSOUNDBUFFER8 iface)
{ {
IDirectSoundBufferImpl *This = (IDirectSoundBufferImpl *)iface; IDirectSoundBufferImpl *This = (IDirectSoundBufferImpl *)iface;
TRACE("(%p) ref was %ld, thread is %04lx\n",This, This->ref, GetCurrentThreadId()); ULONG ref = InterlockedIncrement(&(This->ref));
return InterlockedIncrement(&(This->ref)); TRACE("(%p) ref was %ld\n", This, ref - 1);
return ref;
} }
static ULONG WINAPI IDirectSoundBufferImpl_Release(LPDIRECTSOUNDBUFFER8 iface) static ULONG WINAPI IDirectSoundBufferImpl_Release(LPDIRECTSOUNDBUFFER8 iface)
{ {
IDirectSoundBufferImpl *This = (IDirectSoundBufferImpl *)iface; IDirectSoundBufferImpl *This = (IDirectSoundBufferImpl *)iface;
ULONG ref; ULONG ref = InterlockedDecrement(&(This->ref));
TRACE("(%p) ref was %ld\n", This, ref + 1);
TRACE("(%p) ref was %ld, thread is %04lx\n",This, This->ref, GetCurrentThreadId());
ref = InterlockedDecrement(&(This->ref));
if (ref)
return ref;
if (!ref) {
DSOUND_RemoveBuffer(This->dsound, This); DSOUND_RemoveBuffer(This->dsound, This);
This->lock.DebugInfo->Spare[1] = 0; This->lock.DebugInfo->Spare[1] = 0;
@ -390,10 +387,11 @@ static ULONG WINAPI IDirectSoundBufferImpl_Release(LPDIRECTSOUNDBUFFER8 iface)
HeapFree(GetProcessHeap(), 0, This->notifies); HeapFree(GetProcessHeap(), 0, This->notifies);
HeapFree(GetProcessHeap(), 0, This->pwfx); HeapFree(GetProcessHeap(), 0, This->pwfx);
HeapFree(GetProcessHeap(),0,This); HeapFree(GetProcessHeap(), 0, This);
TRACE("(%p) released\n",This); TRACE("(%p) released\n", This);
return 0; }
return ref;
} }
DWORD DSOUND_CalcPlayPosition(IDirectSoundBufferImpl *This, DWORD DSOUND_CalcPlayPosition(IDirectSoundBufferImpl *This,
@ -1246,25 +1244,25 @@ static HRESULT WINAPI SecondaryBufferImpl_QueryInterface(
static ULONG WINAPI SecondaryBufferImpl_AddRef(LPDIRECTSOUNDBUFFER8 iface) static ULONG WINAPI SecondaryBufferImpl_AddRef(LPDIRECTSOUNDBUFFER8 iface)
{ {
IDirectSoundBufferImpl *This = (IDirectSoundBufferImpl *)iface; IDirectSoundBufferImpl *This = (IDirectSoundBufferImpl *)iface;
TRACE("(%p) ref was %ld, thread is %04lx\n",This, This->ref, GetCurrentThreadId()); ULONG ref = InterlockedIncrement(&(This->ref));
return InterlockedIncrement(&(This->ref)); TRACE("(%p) ref was %ld\n", This, ref - 1);
return ref;
} }
static ULONG WINAPI SecondaryBufferImpl_Release(LPDIRECTSOUNDBUFFER8 iface) static ULONG WINAPI SecondaryBufferImpl_Release(LPDIRECTSOUNDBUFFER8 iface)
{ {
IDirectSoundBufferImpl *This = (IDirectSoundBufferImpl *)iface; IDirectSoundBufferImpl *This = (IDirectSoundBufferImpl *)iface;
ULONG ref; ULONG ref = InterlockedDecrement(&(This->ref));
TRACE("(%p) ref was %ld, thread is %04lx\n",This, This->ref, GetCurrentThreadId()); TRACE("(%p) ref was %ld\n", This, ref + 1);
ref = InterlockedDecrement(&(This->ref)); if (!ref) {
if (!ref) { This->dsb->dsb = NULL;
This->dsb->dsb = NULL; IDirectSoundBuffer_Release((LPDIRECTSOUNDBUFFER8)This->dsb);
IDirectSoundBuffer_Release((LPDIRECTSOUNDBUFFER8)This->dsb); HeapFree(GetProcessHeap(), 0, This);
HeapFree(GetProcessHeap(),0,This); TRACE("(%p) released\n", This);
TRACE("(%p) released\n",This); }
} return ref;
return ref;
} }
static HRESULT WINAPI SecondaryBufferImpl_GetCaps( static HRESULT WINAPI SecondaryBufferImpl_GetCaps(

View File

@ -363,19 +363,19 @@ static ULONG WINAPI
IDirectSoundCaptureImpl_AddRef( LPDIRECTSOUNDCAPTURE iface ) IDirectSoundCaptureImpl_AddRef( LPDIRECTSOUNDCAPTURE iface )
{ {
IDirectSoundCaptureImpl *This = (IDirectSoundCaptureImpl *)iface; IDirectSoundCaptureImpl *This = (IDirectSoundCaptureImpl *)iface;
TRACE("(%p) ref was %ld, thread is %04lx\n",This, This->ref, GetCurrentThreadId()); ULONG ref = InterlockedIncrement(&(This->ref));
return InterlockedIncrement(&(This->ref)); TRACE("(%p) ref was %ld\n", This, ref - 1);
return ref;
} }
static ULONG WINAPI static ULONG WINAPI
IDirectSoundCaptureImpl_Release( LPDIRECTSOUNDCAPTURE iface ) IDirectSoundCaptureImpl_Release( LPDIRECTSOUNDCAPTURE iface )
{ {
ULONG uRef;
IDirectSoundCaptureImpl *This = (IDirectSoundCaptureImpl *)iface; IDirectSoundCaptureImpl *This = (IDirectSoundCaptureImpl *)iface;
TRACE("(%p) ref was %ld, thread is %04lx\n",This, This->ref, GetCurrentThreadId()); ULONG ref = InterlockedDecrement(&(This->ref));
TRACE("(%p) ref was %ld\n", This, ref + 1);
uRef = InterlockedDecrement(&(This->ref)); if (!ref) {
if ( uRef == 0 ) {
TRACE("deleting object\n"); TRACE("deleting object\n");
if (This->capture_buffer) if (This->capture_buffer)
IDirectSoundCaptureBufferImpl_Release( IDirectSoundCaptureBufferImpl_Release(
@ -391,10 +391,9 @@ IDirectSoundCaptureImpl_Release( LPDIRECTSOUNDCAPTURE iface )
DeleteCriticalSection( &(This->lock) ); DeleteCriticalSection( &(This->lock) );
HeapFree( GetProcessHeap(), 0, This ); HeapFree( GetProcessHeap(), 0, This );
dsound_capture = NULL; dsound_capture = NULL;
TRACE("(%p) released\n",This); TRACE("(%p) released\n", This);
} }
return ref;
return uRef;
} }
static HRESULT WINAPI static HRESULT WINAPI
@ -788,25 +787,24 @@ static HRESULT WINAPI IDirectSoundCaptureNotifyImpl_QueryInterface(
static ULONG WINAPI IDirectSoundCaptureNotifyImpl_AddRef(LPDIRECTSOUNDNOTIFY iface) static ULONG WINAPI IDirectSoundCaptureNotifyImpl_AddRef(LPDIRECTSOUNDNOTIFY iface)
{ {
IDirectSoundCaptureNotifyImpl *This = (IDirectSoundCaptureNotifyImpl *)iface; IDirectSoundCaptureNotifyImpl *This = (IDirectSoundCaptureNotifyImpl *)iface;
TRACE("(%p) ref was %ld, thread is %04lx\n",This, This->ref, GetCurrentThreadId()); ULONG ref = InterlockedIncrement(&(This->ref));
return InterlockedIncrement(&(This->ref)); TRACE("(%p) ref was %ld\n", This, ref - 1);
return ref;
} }
static ULONG WINAPI IDirectSoundCaptureNotifyImpl_Release(LPDIRECTSOUNDNOTIFY iface) static ULONG WINAPI IDirectSoundCaptureNotifyImpl_Release(LPDIRECTSOUNDNOTIFY iface)
{ {
IDirectSoundCaptureNotifyImpl *This = (IDirectSoundCaptureNotifyImpl *)iface; IDirectSoundCaptureNotifyImpl *This = (IDirectSoundCaptureNotifyImpl *)iface;
ULONG ref; ULONG ref = InterlockedDecrement(&(This->ref));
TRACE("(%p) ref was %ld\n", This, ref + 1);
TRACE("(%p) ref was %ld, thread is %04lx\n",This, This->ref, GetCurrentThreadId()); if (!ref) {
ref = InterlockedDecrement(&(This->ref));
if (ref == 0) {
if (This->dscb->hwnotify) if (This->dscb->hwnotify)
IDsDriverNotify_Release(This->dscb->hwnotify); IDsDriverNotify_Release(This->dscb->hwnotify);
This->dscb->notify=NULL; This->dscb->notify=NULL;
IDirectSoundCaptureBuffer_Release((LPDIRECTSOUNDCAPTUREBUFFER)This->dscb); IDirectSoundCaptureBuffer_Release((LPDIRECTSOUNDCAPTUREBUFFER)This->dscb);
HeapFree(GetProcessHeap(),0,This); HeapFree(GetProcessHeap(),0,This);
TRACE("(%p) released\n",This); TRACE("(%p) released\n", This);
} }
return ref; return ref;
} }
@ -952,19 +950,19 @@ static ULONG WINAPI
IDirectSoundCaptureBufferImpl_AddRef( LPDIRECTSOUNDCAPTUREBUFFER8 iface ) IDirectSoundCaptureBufferImpl_AddRef( LPDIRECTSOUNDCAPTUREBUFFER8 iface )
{ {
IDirectSoundCaptureBufferImpl *This = (IDirectSoundCaptureBufferImpl *)iface; IDirectSoundCaptureBufferImpl *This = (IDirectSoundCaptureBufferImpl *)iface;
TRACE("(%p) ref was %ld, thread is %04lx\n",This, This->ref, GetCurrentThreadId()); ULONG ref = InterlockedIncrement(&(This->ref));
return InterlockedIncrement(&(This->ref)); TRACE("(%p) ref was %ld\n", This, ref - 1);
return ref;
} }
static ULONG WINAPI static ULONG WINAPI
IDirectSoundCaptureBufferImpl_Release( LPDIRECTSOUNDCAPTUREBUFFER8 iface ) IDirectSoundCaptureBufferImpl_Release( LPDIRECTSOUNDCAPTUREBUFFER8 iface )
{ {
ULONG uRef;
IDirectSoundCaptureBufferImpl *This = (IDirectSoundCaptureBufferImpl *)iface; IDirectSoundCaptureBufferImpl *This = (IDirectSoundCaptureBufferImpl *)iface;
TRACE("(%p) ref was %ld, thread is %04lx\n",This, This->ref, GetCurrentThreadId()); ULONG ref = InterlockedDecrement(&(This->ref));
TRACE("(%p) ref was %ld\n", This, ref + 1);
uRef = InterlockedDecrement(&(This->ref)); if (!ref) {
if ( uRef == 0 ) {
TRACE("deleting object\n"); TRACE("deleting object\n");
if (This->dsound->state == STATE_CAPTURING) if (This->dsound->state == STATE_CAPTURING)
This->dsound->state = STATE_STOPPING; This->dsound->state = STATE_STOPPING;
@ -993,10 +991,9 @@ IDirectSoundCaptureBufferImpl_Release( LPDIRECTSOUNDCAPTUREBUFFER8 iface )
HeapFree(GetProcessHeap(), 0, This->notifies); HeapFree(GetProcessHeap(), 0, This->notifies);
HeapFree( GetProcessHeap(), 0, This ); HeapFree( GetProcessHeap(), 0, This );
TRACE("(%p) released\n",This); TRACE("(%p) released\n", This);
} }
return ref;
return uRef;
} }
static HRESULT WINAPI static HRESULT WINAPI
@ -1578,17 +1575,19 @@ static ULONG WINAPI
DSCCF_AddRef(LPCLASSFACTORY iface) DSCCF_AddRef(LPCLASSFACTORY iface)
{ {
IClassFactoryImpl *This = (IClassFactoryImpl *)iface; IClassFactoryImpl *This = (IClassFactoryImpl *)iface;
TRACE("(%p) ref was %ld\n", This, This->ref); ULONG ref = InterlockedIncrement(&(This->ref));
return InterlockedIncrement(&(This->ref)); TRACE("(%p) ref was %ld\n", This, ref - 1);
return ref;
} }
static ULONG WINAPI static ULONG WINAPI
DSCCF_Release(LPCLASSFACTORY iface) DSCCF_Release(LPCLASSFACTORY iface)
{ {
IClassFactoryImpl *This = (IClassFactoryImpl *)iface; IClassFactoryImpl *This = (IClassFactoryImpl *)iface;
ULONG ref = InterlockedDecrement(&(This->ref));
TRACE("(%p) ref was %ld\n", This, ref + 1);
/* static class, won't be freed */ /* static class, won't be freed */
TRACE("(%p) ref was %ld\n", This, This->ref); return ref;
return InterlockedDecrement(&(This->ref));
} }
static HRESULT WINAPI static HRESULT WINAPI
@ -1729,26 +1728,25 @@ static ULONG WINAPI
IDirectSoundFullDuplexImpl_AddRef( LPDIRECTSOUNDFULLDUPLEX iface ) IDirectSoundFullDuplexImpl_AddRef( LPDIRECTSOUNDFULLDUPLEX iface )
{ {
IDirectSoundFullDuplexImpl *This = (IDirectSoundFullDuplexImpl *)iface; IDirectSoundFullDuplexImpl *This = (IDirectSoundFullDuplexImpl *)iface;
TRACE("(%p) ref was %ld, thread is %04lx\n",This, This->ref, GetCurrentThreadId()); ULONG ref = InterlockedIncrement(&(This->ref));
return InterlockedIncrement(&(This->ref)); TRACE("(%p) ref was %ld\n", This, ref - 1);
return ref;
} }
static ULONG WINAPI static ULONG WINAPI
IDirectSoundFullDuplexImpl_Release( LPDIRECTSOUNDFULLDUPLEX iface ) IDirectSoundFullDuplexImpl_Release( LPDIRECTSOUNDFULLDUPLEX iface )
{ {
ULONG uRef;
IDirectSoundFullDuplexImpl *This = (IDirectSoundFullDuplexImpl *)iface; IDirectSoundFullDuplexImpl *This = (IDirectSoundFullDuplexImpl *)iface;
TRACE("(%p) ref was %ld, thread is %04lx\n",This, This->ref, GetCurrentThreadId()); ULONG ref = InterlockedDecrement(&(This->ref));
TRACE("(%p) ref was %ld\n", This, ref - 1);
uRef = InterlockedDecrement(&(This->ref)); if (!ref) {
if ( uRef == 0 ) {
This->lock.DebugInfo->Spare[1] = 0; This->lock.DebugInfo->Spare[1] = 0;
DeleteCriticalSection( &(This->lock) ); DeleteCriticalSection( &(This->lock) );
HeapFree( GetProcessHeap(), 0, This ); HeapFree( GetProcessHeap(), 0, This );
TRACE("(%p) released\n",This); TRACE("(%p) released\n", This);
} }
return ref;
return uRef;
} }
static HRESULT WINAPI static HRESULT WINAPI

View File

@ -230,21 +230,19 @@ static ULONG WINAPI IDirectSoundImpl_AddRef(
LPDIRECTSOUND8 iface) LPDIRECTSOUND8 iface)
{ {
IDirectSoundImpl *This = (IDirectSoundImpl *)iface; IDirectSoundImpl *This = (IDirectSoundImpl *)iface;
TRACE("(%p) ref was %ld, thread is %04lx\n", This, This->ref, GetCurrentThreadId()); ULONG ref = InterlockedIncrement(&(This->ref));
TRACE("(%p) ref was %ld\n", This, ref - 1);
return InterlockedIncrement(&(This->ref)); return ref;
} }
static ULONG WINAPI IDirectSoundImpl_Release( static ULONG WINAPI IDirectSoundImpl_Release(
LPDIRECTSOUND8 iface) LPDIRECTSOUND8 iface)
{ {
IDirectSoundImpl *This = (IDirectSoundImpl *)iface; IDirectSoundImpl *This = (IDirectSoundImpl *)iface;
ULONG ref; ULONG ref = InterlockedDecrement(&(This->ref));
TRACE("(%p) ref was %ld, thread is %04lx\n", TRACE("(%p) ref was %ld\n", This, ref + 1);
This, This->ref, GetCurrentThreadId());
ref = InterlockedDecrement(&(This->ref)); if (!ref) {
if (ref == 0) {
HRESULT hres; HRESULT hres;
INT i; INT i;
@ -291,9 +289,8 @@ static ULONG WINAPI IDirectSoundImpl_Release(
DeleteCriticalSection(&This->mixlock); DeleteCriticalSection(&This->mixlock);
HeapFree(GetProcessHeap(),0,This); HeapFree(GetProcessHeap(),0,This);
dsound = NULL; dsound = NULL;
TRACE("(%p) released\n",This); TRACE("(%p) released\n", This);
} }
return ref; return ref;
} }
@ -971,23 +968,23 @@ static ULONG WINAPI IDirectSound_IUnknown_AddRef(
LPUNKNOWN iface) LPUNKNOWN iface)
{ {
IDirectSound_IUnknown *This = (IDirectSound_IUnknown *)iface; IDirectSound_IUnknown *This = (IDirectSound_IUnknown *)iface;
TRACE("(%p) ref was %ld, thread is %04lx\n", This, This->ref, GetCurrentThreadId()); ULONG ref = InterlockedIncrement(&(This->ref));
return InterlockedIncrement(&(This->ref)); TRACE("(%p) ref was %ld\n", This, ref - 1);
return ref;
} }
static ULONG WINAPI IDirectSound_IUnknown_Release( static ULONG WINAPI IDirectSound_IUnknown_Release(
LPUNKNOWN iface) LPUNKNOWN iface)
{ {
IDirectSound_IUnknown *This = (IDirectSound_IUnknown *)iface; IDirectSound_IUnknown *This = (IDirectSound_IUnknown *)iface;
ULONG ulReturn; ULONG ref = InterlockedDecrement(&(This->ref));
TRACE("(%p) ref was %ld, thread is %04lx\n", This, This->ref, GetCurrentThreadId()); TRACE("(%p) ref was %ld\n", This, ref + 1);
ulReturn = InterlockedDecrement(&(This->ref)); if (!ref) {
if (ulReturn == 0) {
IDirectSoundImpl_Release(This->pds); IDirectSoundImpl_Release(This->pds);
HeapFree(GetProcessHeap(),0,This); HeapFree(GetProcessHeap(), 0, This);
TRACE("(%p) released\n",This); TRACE("(%p) released\n", This);
} }
return ulReturn; return ref;
} }
static IUnknownVtbl DirectSound_Unknown_Vtbl = static IUnknownVtbl DirectSound_Unknown_Vtbl =
@ -1049,23 +1046,23 @@ static ULONG WINAPI IDirectSound_IDirectSound_AddRef(
LPDIRECTSOUND iface) LPDIRECTSOUND iface)
{ {
IDirectSound_IDirectSound *This = (IDirectSound_IDirectSound *)iface; IDirectSound_IDirectSound *This = (IDirectSound_IDirectSound *)iface;
TRACE("(%p) ref was %ld, thread is %04lx\n", This, This->ref, GetCurrentThreadId()); ULONG ref = InterlockedIncrement(&(This->ref));
return InterlockedIncrement(&(This->ref)); TRACE("(%p) ref was %ld\n", This, ref - 1);
return ref;
} }
static ULONG WINAPI IDirectSound_IDirectSound_Release( static ULONG WINAPI IDirectSound_IDirectSound_Release(
LPDIRECTSOUND iface) LPDIRECTSOUND iface)
{ {
IDirectSound_IDirectSound *This = (IDirectSound_IDirectSound *)iface; IDirectSound_IDirectSound *This = (IDirectSound_IDirectSound *)iface;
ULONG ulReturn; ULONG ref = InterlockedDecrement(&(This->ref));
TRACE("(%p) ref was %ld, thread is %04lx\n", This, This->ref, GetCurrentThreadId()); TRACE("(%p) ref was %ld\n", This, ref + 1);
ulReturn = InterlockedDecrement(&This->ref); if (!ref) {
if (ulReturn == 0) {
IDirectSoundImpl_Release(This->pds); IDirectSoundImpl_Release(This->pds);
HeapFree(GetProcessHeap(),0,This); HeapFree(GetProcessHeap(), 0, This);
TRACE("(%p) released\n",This); TRACE("(%p) released\n", This);
} }
return ulReturn; return ref;
} }
static HRESULT WINAPI IDirectSound_IDirectSound_CreateSoundBuffer( static HRESULT WINAPI IDirectSound_IDirectSound_CreateSoundBuffer(
@ -1210,23 +1207,23 @@ static ULONG WINAPI IDirectSound8_IUnknown_AddRef(
LPUNKNOWN iface) LPUNKNOWN iface)
{ {
IDirectSound_IUnknown *This = (IDirectSound_IUnknown *)iface; IDirectSound_IUnknown *This = (IDirectSound_IUnknown *)iface;
TRACE("(%p) ref was %ld, thread is %04lx\n", This, This->ref, GetCurrentThreadId()); ULONG ref = InterlockedIncrement(&(This->ref));
return InterlockedIncrement(&(This->ref)); TRACE("(%p) ref was %ld\n", This, ref - 1);
return ref;
} }
static ULONG WINAPI IDirectSound8_IUnknown_Release( static ULONG WINAPI IDirectSound8_IUnknown_Release(
LPUNKNOWN iface) LPUNKNOWN iface)
{ {
IDirectSound_IUnknown *This = (IDirectSound_IUnknown *)iface; IDirectSound_IUnknown *This = (IDirectSound_IUnknown *)iface;
ULONG ulReturn; ULONG ref = InterlockedDecrement(&(This->ref));
TRACE("(%p) ref was %ld, thread is %04lx\n", This, This->ref, GetCurrentThreadId()); TRACE("(%p) ref was %ld\n", This, ref + 1);
ulReturn = InterlockedDecrement(&(This->ref)); if (!ref) {
if (ulReturn == 0) {
IDirectSoundImpl_Release(This->pds); IDirectSoundImpl_Release(This->pds);
HeapFree(GetProcessHeap(),0,This); HeapFree(GetProcessHeap(), 0, This);
TRACE("(%p) released\n",This); TRACE("(%p) released\n", This);
} }
return ulReturn; return ref;
} }
static IUnknownVtbl DirectSound8_Unknown_Vtbl = static IUnknownVtbl DirectSound8_Unknown_Vtbl =
@ -1288,23 +1285,23 @@ static ULONG WINAPI IDirectSound8_IDirectSound_AddRef(
LPDIRECTSOUND iface) LPDIRECTSOUND iface)
{ {
IDirectSound8_IDirectSound *This = (IDirectSound8_IDirectSound *)iface; IDirectSound8_IDirectSound *This = (IDirectSound8_IDirectSound *)iface;
TRACE("(%p) ref was %ld, thread is %04lx\n", This, This->ref, GetCurrentThreadId()); ULONG ref = InterlockedIncrement(&(This->ref));
return InterlockedIncrement(&(This->ref)); TRACE("(%p) ref was %ld\n", This, ref - 1);
return ref;
} }
static ULONG WINAPI IDirectSound8_IDirectSound_Release( static ULONG WINAPI IDirectSound8_IDirectSound_Release(
LPDIRECTSOUND iface) LPDIRECTSOUND iface)
{ {
IDirectSound8_IDirectSound *This = (IDirectSound8_IDirectSound *)iface; IDirectSound8_IDirectSound *This = (IDirectSound8_IDirectSound *)iface;
ULONG ulReturn; ULONG ref = InterlockedDecrement(&(This->ref));
TRACE("(%p) ref was %ld, thread is %04lx\n", This, This->ref, GetCurrentThreadId()); TRACE("(%p) ref was %ld\n", This, ref + 1);
ulReturn = InterlockedDecrement(&(This->ref)); if (!ref) {
if (ulReturn == 0) {
IDirectSoundImpl_Release(This->pds); IDirectSoundImpl_Release(This->pds);
HeapFree(GetProcessHeap(),0,This); HeapFree(GetProcessHeap(), 0, This);
TRACE("(%p) released\n",This); TRACE("(%p) released\n", This);
} }
return ulReturn; return ref;
} }
static HRESULT WINAPI IDirectSound8_IDirectSound_CreateSoundBuffer( static HRESULT WINAPI IDirectSound8_IDirectSound_CreateSoundBuffer(
@ -1449,23 +1446,23 @@ static ULONG WINAPI IDirectSound8_IDirectSound8_AddRef(
LPDIRECTSOUND8 iface) LPDIRECTSOUND8 iface)
{ {
IDirectSound8_IDirectSound8 *This = (IDirectSound8_IDirectSound8 *)iface; IDirectSound8_IDirectSound8 *This = (IDirectSound8_IDirectSound8 *)iface;
TRACE("(%p) ref was %ld, thread is %04lx\n", This, This->ref, GetCurrentThreadId()); ULONG ref = InterlockedIncrement(&(This->ref));
return InterlockedIncrement(&(This->ref)); TRACE("(%p) ref was %ld\n", This, ref - 1);
return ref;
} }
static ULONG WINAPI IDirectSound8_IDirectSound8_Release( static ULONG WINAPI IDirectSound8_IDirectSound8_Release(
LPDIRECTSOUND8 iface) LPDIRECTSOUND8 iface)
{ {
IDirectSound8_IDirectSound8 *This = (IDirectSound8_IDirectSound8 *)iface; IDirectSound8_IDirectSound8 *This = (IDirectSound8_IDirectSound8 *)iface;
ULONG ulReturn; ULONG ref = InterlockedDecrement(&(This->ref));
TRACE("(%p) ref was %ld, thread is %04lx\n", This, This->ref, GetCurrentThreadId()); TRACE("(%p) ref was %ld\n", This, ref + 1);
ulReturn = InterlockedDecrement(&(This->ref)); if (!ref) {
if (ulReturn == 0) {
IDirectSoundImpl_Release(This->pds); IDirectSoundImpl_Release(This->pds);
HeapFree(GetProcessHeap(),0,This); HeapFree(GetProcessHeap(), 0, This);
TRACE("(%p) released\n",This); TRACE("(%p) released\n", This);
} }
return ulReturn; return ref;
} }
static HRESULT WINAPI IDirectSound8_IDirectSound8_CreateSoundBuffer( static HRESULT WINAPI IDirectSound8_IDirectSound8_CreateSoundBuffer(

View File

@ -427,18 +427,21 @@ DSCF_QueryInterface(LPCLASSFACTORY iface,REFIID riid,LPVOID *ppobj) {
return E_NOINTERFACE; return E_NOINTERFACE;
} }
static ULONG WINAPI static ULONG WINAPI DSCF_AddRef(LPCLASSFACTORY iface)
DSCF_AddRef(LPCLASSFACTORY iface) { {
IClassFactoryImpl *This = (IClassFactoryImpl *)iface; IClassFactoryImpl *This = (IClassFactoryImpl *)iface;
TRACE("(%p) ref was %ld\n", This, This->ref); ULONG ref = InterlockedIncrement(&(This->ref));
return InterlockedIncrement(&(This->ref)); TRACE("(%p) ref was %ld\n", This, ref - 1);
return ref;
} }
static ULONG WINAPI DSCF_Release(LPCLASSFACTORY iface) { static ULONG WINAPI DSCF_Release(LPCLASSFACTORY iface)
IClassFactoryImpl *This = (IClassFactoryImpl *)iface; {
/* static class, won't be freed */ IClassFactoryImpl *This = (IClassFactoryImpl *)iface;
TRACE("(%p) ref was %ld\n", This, This->ref); ULONG ref = InterlockedDecrement(&(This->ref));
return InterlockedDecrement(&(This->ref)); TRACE("(%p) ref was %ld\n", This, ref + 1);
/* static class, won't be freed */
return ref;
} }
static HRESULT WINAPI DSCF_CreateInstance( static HRESULT WINAPI DSCF_CreateInstance(
@ -495,19 +498,21 @@ DSPCF_QueryInterface(LPCLASSFACTORY iface,REFIID riid,LPVOID *ppobj) {
return E_NOINTERFACE; return E_NOINTERFACE;
} }
static ULONG WINAPI static ULONG WINAPI DSPCF_AddRef(LPCLASSFACTORY iface)
DSPCF_AddRef(LPCLASSFACTORY iface) { {
IClassFactoryImpl *This = (IClassFactoryImpl *)iface; IClassFactoryImpl *This = (IClassFactoryImpl *)iface;
TRACE("(%p) ref was %ld\n", This, This->ref); ULONG ref = InterlockedIncrement(&(This->ref));
return InterlockedIncrement(&(This->ref)); TRACE("(%p) ref was %ld\n", This, ref - 1);
return ref;
} }
static ULONG WINAPI static ULONG WINAPI DSPCF_Release(LPCLASSFACTORY iface)
DSPCF_Release(LPCLASSFACTORY iface) { {
IClassFactoryImpl *This = (IClassFactoryImpl *)iface; IClassFactoryImpl *This = (IClassFactoryImpl *)iface;
/* static class, won't be freed */ ULONG ref = InterlockedDecrement(&(This->ref));
TRACE("(%p) ref was %ld\n", This, This->ref); TRACE("(%p) ref was %ld\n", This, ref + 1);
return InterlockedDecrement(&(This->ref)); /* static class, won't be freed */
return ref;
} }
static HRESULT WINAPI static HRESULT WINAPI

View File

@ -562,26 +562,26 @@ static HRESULT WINAPI PrimaryBufferImpl_Stop(LPDIRECTSOUNDBUFFER8 iface)
return DS_OK; return DS_OK;
} }
static ULONG WINAPI PrimaryBufferImpl_AddRef(LPDIRECTSOUNDBUFFER8 iface) { static ULONG WINAPI PrimaryBufferImpl_AddRef(LPDIRECTSOUNDBUFFER8 iface)
PrimaryBufferImpl *This = (PrimaryBufferImpl *)iface; {
TRACE("(%p) ref was %ld, thread is %04lx\n",This, This->ref, GetCurrentThreadId()); PrimaryBufferImpl *This = (PrimaryBufferImpl *)iface;
return InterlockedIncrement(&(This->ref)); ULONG ref = InterlockedIncrement(&(This->ref));
TRACE("(%p) ref was %ld\n", This, ref - 1);
return ref;
} }
static ULONG WINAPI PrimaryBufferImpl_Release(LPDIRECTSOUNDBUFFER8 iface) { static ULONG WINAPI PrimaryBufferImpl_Release(LPDIRECTSOUNDBUFFER8 iface)
PrimaryBufferImpl *This = (PrimaryBufferImpl *)iface; {
DWORD ref; PrimaryBufferImpl *This = (PrimaryBufferImpl *)iface;
DWORD ref = InterlockedDecrement(&(This->ref));
TRACE("(%p) ref was %ld\n", This, ref + 1);
TRACE("(%p) ref was %ld, thread is %04lx\n",This, This->ref, GetCurrentThreadId()); if (!ref) {
ref = InterlockedDecrement(&(This->ref)); This->dsound->primary = NULL;
HeapFree(GetProcessHeap(), 0, This);
if (ref == 0) { TRACE("(%p) released\n", This);
This->dsound->primary = NULL; }
HeapFree(GetProcessHeap(),0,This); return ref;
TRACE("(%p) released\n",This);
}
return ref;
} }
static HRESULT WINAPI PrimaryBufferImpl_GetCurrentPosition( static HRESULT WINAPI PrimaryBufferImpl_GetCurrentPosition(

View File

@ -64,24 +64,24 @@ static HRESULT WINAPI IKsBufferPropertySetImpl_QueryInterface(
static ULONG WINAPI IKsBufferPropertySetImpl_AddRef(LPKSPROPERTYSET iface) static ULONG WINAPI IKsBufferPropertySetImpl_AddRef(LPKSPROPERTYSET iface)
{ {
IKsBufferPropertySetImpl *This = (IKsBufferPropertySetImpl *)iface; IKsBufferPropertySetImpl *This = (IKsBufferPropertySetImpl *)iface;
TRACE("(%p) ref was %ld\n", This, This->ref); ULONG ref = InterlockedIncrement(&(This->ref));
return InterlockedIncrement(&(This->ref)); TRACE("(%p) ref was %ld\n", This, ref - 1);
return ref;
} }
static ULONG WINAPI IKsBufferPropertySetImpl_Release(LPKSPROPERTYSET iface) static ULONG WINAPI IKsBufferPropertySetImpl_Release(LPKSPROPERTYSET iface)
{ {
IKsBufferPropertySetImpl *This = (IKsBufferPropertySetImpl *)iface; IKsBufferPropertySetImpl *This = (IKsBufferPropertySetImpl *)iface;
ULONG ulReturn; ULONG ref = InterlockedDecrement(&(This->ref));
TRACE("(%p) ref was %ld\n", This, ref + 1);
TRACE("(%p) ref was %ld\n", This, This->ref); if (!ref) {
ulReturn = InterlockedDecrement(&(This->ref));
if (!ulReturn) {
This->dsb->iks = 0; This->dsb->iks = 0;
IDirectSoundBuffer_Release((LPDIRECTSOUND3DBUFFER)This->dsb); IDirectSoundBuffer_Release((LPDIRECTSOUND3DBUFFER)This->dsb);
HeapFree(GetProcessHeap(),0,This); HeapFree(GetProcessHeap(), 0, This);
TRACE("(%p) released\n",This); TRACE("(%p) released\n", This);
} }
return ulReturn; return ref;
} }
static HRESULT WINAPI IKsBufferPropertySetImpl_Get( static HRESULT WINAPI IKsBufferPropertySetImpl_Get(
@ -248,22 +248,22 @@ static HRESULT WINAPI IKsPrivatePropertySetImpl_QueryInterface(
static ULONG WINAPI IKsPrivatePropertySetImpl_AddRef(LPKSPROPERTYSET iface) static ULONG WINAPI IKsPrivatePropertySetImpl_AddRef(LPKSPROPERTYSET iface)
{ {
IKsPrivatePropertySetImpl *This = (IKsPrivatePropertySetImpl *)iface; IKsPrivatePropertySetImpl *This = (IKsPrivatePropertySetImpl *)iface;
TRACE("(%p) ref was %ld\n", This, This->ref); ULONG ref = InterlockedIncrement(&(This->ref));
return InterlockedIncrement(&(This->ref)); TRACE("(%p) ref was %ld\n", This, ref - 1);
return ref;
} }
static ULONG WINAPI IKsPrivatePropertySetImpl_Release(LPKSPROPERTYSET iface) static ULONG WINAPI IKsPrivatePropertySetImpl_Release(LPKSPROPERTYSET iface)
{ {
IKsPrivatePropertySetImpl *This = (IKsPrivatePropertySetImpl *)iface; IKsPrivatePropertySetImpl *This = (IKsPrivatePropertySetImpl *)iface;
ULONG ulReturn; ULONG ref = InterlockedDecrement(&(This->ref));
TRACE("(%p) ref was %ld\n", This, ref + 1);
TRACE("(%p) ref was %ld\n", This, This->ref); if (!ref) {
ulReturn = InterlockedDecrement(&(This->ref)); HeapFree(GetProcessHeap(), 0, This);
if (ulReturn == 0) { TRACE("(%p) released\n", This);
HeapFree(GetProcessHeap(),0,This);
TRACE("(%p) released\n",This);
} }
return ulReturn; return ref;
} }
static HRESULT WINAPI DSPROPERTY_WaveDeviceMappingA( static HRESULT WINAPI DSPROPERTY_WaveDeviceMappingA(

View File

@ -364,26 +364,25 @@ static HRESULT WINAPI IDirectSound3DBufferImpl_QueryInterface(
static ULONG WINAPI IDirectSound3DBufferImpl_AddRef(LPDIRECTSOUND3DBUFFER iface) static ULONG WINAPI IDirectSound3DBufferImpl_AddRef(LPDIRECTSOUND3DBUFFER iface)
{ {
IDirectSound3DBufferImpl *This = (IDirectSound3DBufferImpl *)iface; IDirectSound3DBufferImpl *This = (IDirectSound3DBufferImpl *)iface;
TRACE("(%p) ref was %ld, thread is %04lx\n",This, This->ref, GetCurrentThreadId()); ULONG ref = InterlockedIncrement(&(This->ref));
return InterlockedIncrement(&(This->ref)); TRACE("(%p) ref was %ld\n", This, ref - 1);
return ref;
} }
static ULONG WINAPI IDirectSound3DBufferImpl_Release(LPDIRECTSOUND3DBUFFER iface) static ULONG WINAPI IDirectSound3DBufferImpl_Release(LPDIRECTSOUND3DBUFFER iface)
{ {
IDirectSound3DBufferImpl *This = (IDirectSound3DBufferImpl *)iface; IDirectSound3DBufferImpl *This = (IDirectSound3DBufferImpl *)iface;
ULONG ulReturn; ULONG ref = InterlockedDecrement(&(This->ref));
TRACE("(%p) ref was %ld\n", This, ref + 1);
TRACE("(%p) ref was %ld, thread is %04lx\n",This, This->ref, GetCurrentThreadId()); if (!ref) {
ulReturn = InterlockedDecrement(&(This->ref)); This->dsb->ds3db = NULL;
if (!ulReturn) { IDirectSoundBuffer_Release((LPDIRECTSOUNDBUFFER8)This->dsb);
This->dsb->ds3db = NULL; HeapFree(GetProcessHeap(), 0, This);
IDirectSoundBuffer_Release((LPDIRECTSOUNDBUFFER8)This->dsb); TRACE("(%p) released\n", This);
HeapFree(GetProcessHeap(),0,This); }
TRACE("(%p) released\n",This); return ref;
}
return ulReturn;
} }
/* IDirectSound3DBuffer methods */ /* IDirectSound3DBuffer methods */
@ -801,27 +800,24 @@ static HRESULT WINAPI IDirectSound3DListenerImpl_QueryInterface(
static ULONG WINAPI IDirectSound3DListenerImpl_AddRef(LPDIRECTSOUND3DLISTENER iface) static ULONG WINAPI IDirectSound3DListenerImpl_AddRef(LPDIRECTSOUND3DLISTENER iface)
{ {
IDirectSound3DListenerImpl *This = (IDirectSound3DListenerImpl *)iface; IDirectSound3DListenerImpl *This = (IDirectSound3DListenerImpl *)iface;
TRACE("(%p) ref was %ld, thread is %04lx\n",This, This->ref, GetCurrentThreadId()); ULONG ref = InterlockedIncrement(&(This->ref));
return InterlockedIncrement(&(This->ref)); TRACE("(%p) ref was %ld\n", This, ref - 1);
return ref;
} }
static ULONG WINAPI IDirectSound3DListenerImpl_Release(LPDIRECTSOUND3DLISTENER iface) static ULONG WINAPI IDirectSound3DListenerImpl_Release(LPDIRECTSOUND3DLISTENER iface)
{ {
IDirectSound3DListenerImpl *This = (IDirectSound3DListenerImpl *)iface; IDirectSound3DListenerImpl *This = (IDirectSound3DListenerImpl *)iface;
ULONG ulReturn; ULONG ref = InterlockedDecrement(&(This->ref));
TRACE("(%p) ref was %ld\n", This, ref + 1);
TRACE("(%p) ref was %ld, thread is %04lx\n",This, This->ref, GetCurrentThreadId()); if (!ref) {
ulReturn = InterlockedDecrement(&(This->ref)); This->dsound->listener = 0;
HeapFree(GetProcessHeap(), 0, This);
/* Free all resources */ TRACE("(%p) released\n", This);
if( ulReturn == 0 ) { }
This->dsound->listener = 0; return ref;
HeapFree(GetProcessHeap(),0,This);
TRACE("(%p) released\n",This);
}
return ulReturn;
} }
/* IDirectSound3DListener methods */ /* IDirectSound3DListener methods */