Commit 836776ae authored by Maarten Lankhorst's avatar Maarten Lankhorst Committed by Alexandre Julliard

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

parent b4bb6e5b
...@@ -213,6 +213,8 @@ HRESULT DSOUND_PrimaryDestroy(DirectSoundDevice *device) ...@@ -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) ...@@ -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) ...@@ -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) ...@@ -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;
} }
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment