Fixed a reference counting bug I introduced.
This commit is contained in:
parent
c5f775a9c7
commit
05fb2c89e1
|
@ -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);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
@ -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;
|
||||||
|
|
Loading…
Reference in New Issue