From ede0f245760341b8823b97fb13a3a6c7e117e522 Mon Sep 17 00:00:00 2001 From: Chris Robinson Date: Sun, 31 Jul 2011 14:41:23 -0700 Subject: [PATCH] Don't allow duplicating lost buffers --- buffer.c | 4 ++++ dsound8.c | 6 +----- 2 files changed, 5 insertions(+), 5 deletions(-) diff --git a/buffer.c b/buffer.c index fe63cd6..518527c 100644 --- a/buffer.c +++ b/buffer.c @@ -696,6 +696,9 @@ HRESULT DS8Buffer_Create(DS8Buffer **ppv, DS8Primary *parent, IDirectSoundBuffer if(orig) { DS8Buffer *org = impl_from_IDirectSoundBuffer(orig); + hr = DSERR_BUFFERLOST; + if(org->bufferlost) + goto fail; DS8Data_AddRef(org->buffer); This->buffer = org->buffer; } @@ -705,6 +708,7 @@ HRESULT DS8Buffer_Create(DS8Buffer **ppv, DS8Primary *parent, IDirectSoundBuffer if(parent->nbuffers == parent->sizebuffers) { bufs = HeapReAlloc(GetProcessHeap(), 0, bufs, sizeof(*bufs)*(1+parent->nbuffers)); + hr = DSERR_OUTOFMEMORY; if(!bufs) goto fail; parent->sizebuffers++; } diff --git a/dsound8.c b/dsound8.c index 4ea7bfe..ce061e8 100644 --- a/dsound8.c +++ b/dsound8.c @@ -438,10 +438,7 @@ static HRESULT WINAPI DS8_DuplicateSoundBuffer(IDirectSound8 *iface, IDirectSoun } if(SUCCEEDED(hr)) { - DWORD savelost = ((DS8Buffer*)in)->bufferlost; - ((DS8Buffer*)in)->bufferlost = 0; - /* According to MSDN volume isn't copied - */ + /* According to MSDN volume isn't copied */ if((caps.dwFlags&DSBCAPS_CTRLPAN)) { LONG pan; @@ -475,7 +472,6 @@ static HRESULT WINAPI DS8_DuplicateSoundBuffer(IDirectSound8 *iface, IDirectSoun IDirectSound3DBuffer_Release(buf3d); } } - ((DS8Buffer*)in)->bufferlost = buf->bufferlost = savelost; } if(FAILED(hr)) { -- 2.11.4.GIT