dsound: Make sure we're holding the lock on Drop And Stop.

This commit is contained in:
Maarten Lankhorst 2007-04-20 22:10:23 +02:00 committed by Alexandre Julliard
parent b4bb6e5b5d
commit 836776ae4f
1 changed files with 5 additions and 0 deletions

View File

@ -213,6 +213,8 @@ HRESULT DSOUND_PrimaryDestroy(DirectSoundDevice *device)
{ {
TRACE("(%p)\n", device); TRACE("(%p)\n", device);
EnterCriticalSection(&(device->mixlock));
DSOUND_PrimaryClose(device); DSOUND_PrimaryClose(device);
if (device->driver) { if (device->driver) {
if (device->hwbuf) { if (device->hwbuf) {
@ -227,6 +229,7 @@ HRESULT DSOUND_PrimaryDestroy(DirectSoundDevice *device)
} }
HeapFree(GetProcessHeap(),0,device->pwfx); HeapFree(GetProcessHeap(),0,device->pwfx);
device->pwfx=NULL; device->pwfx=NULL;
LeaveCriticalSection(&(device->mixlock));
return DS_OK; return DS_OK;
} }
@ -253,6 +256,7 @@ HRESULT DSOUND_PrimaryStop(DirectSoundDevice *device)
HRESULT err = DS_OK; HRESULT err = DS_OK;
TRACE("(%p)\n", device); TRACE("(%p)\n", device);
EnterCriticalSection(&(device->mixlock));
if (device->hwbuf) { if (device->hwbuf) {
err = IDsDriverBuffer_Stop(device->hwbuf); err = IDsDriverBuffer_Stop(device->hwbuf);
if (err == DSERR_BUFFERLOST) { if (err == DSERR_BUFFERLOST) {
@ -285,6 +289,7 @@ HRESULT DSOUND_PrimaryStop(DirectSoundDevice *device)
if (err != DS_OK) if (err != DS_OK)
WARN("waveOutPause failed\n"); WARN("waveOutPause failed\n");
} }
LeaveCriticalSection(&(device->mixlock));
return err; return err;
} }