Fixed a reference counting bug I introduced.

This commit is contained in:
Robert Reif 2003-06-18 19:31:44 +00:00 committed by Alexandre Julliard
parent c5f775a9c7
commit 05fb2c89e1
2 changed files with 3 additions and 9 deletions

View File

@ -571,20 +571,13 @@ static DWORD WINAPI PrimaryBufferImpl_Release(LPDIRECTSOUNDBUFFER8 iface) {
ref = InterlockedDecrement(&(This->ref)); ref = InterlockedDecrement(&(This->ref));
/* the listener has a reference to us which must be removed */ if (ref == 0) {
if ((ref == 0) || ((ref == 1) && (This->dsound->listener))) {
IDirectSound_Release((LPDIRECTSOUND)This->dsound); IDirectSound_Release((LPDIRECTSOUND)This->dsound);
if (This->dsound->listener) { if (This->dsound->listener) {
IDirectSound3DListener_Release((LPDIRECTSOUND3DLISTENER)This->dsound->listener); IDirectSound3DListener_Release((LPDIRECTSOUND3DLISTENER)This->dsound->listener);
This->dsound->listener = NULL; This->dsound->listener = NULL;
ref--;
} }
#if 0
if (This->iks) {
HeapFree(GetProcessHeap(), 0, This->iks);
}
#endif
HeapFree(GetProcessHeap(),0,This); HeapFree(GetProcessHeap(),0,This);
} }

View File

@ -1042,7 +1042,8 @@ HRESULT WINAPI IDirectSound3DListenerImpl_Create(
InitializeCriticalSection(&dsl->lock); InitializeCriticalSection(&dsl->lock);
dsl->dsb = This; dsl->dsb = This;
IDirectSoundBuffer8_AddRef((LPDIRECTSOUNDBUFFER8)This); /* NOTE: don't add a reference because it would cause a circular reference */
/* IDirectSoundBuffer8_AddRef((LPDIRECTSOUNDBUFFER8)This); */
*pdsl = dsl; *pdsl = dsl;
return S_OK; return S_OK;