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

Alexandre Julliard julliard at wine.codeweavers.com
Mon Apr 23 08:39:15 CDT 2007


Module: wine
Branch: master
Commit: 836776ae4f33fb3d554b8b2d2330eda294297dae
URL:    http://source.winehq.org/git/wine.git/?a=commit;h=836776ae4f33fb3d554b8b2d2330eda294297dae

Author: Maarten Lankhorst <m.b.lankhorst at gmail.com>
Date:   Fri Apr 20 22:10:23 2007 +0200

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

---

 dlls/dsound/primary.c |    5 +++++
 1 files changed, 5 insertions(+), 0 deletions(-)

diff --git a/dlls/dsound/primary.c b/dlls/dsound/primary.c
index 9a3498d..0725bd2 100644
--- a/dlls/dsound/primary.c
+++ b/dlls/dsound/primary.c
@@ -213,6 +213,8 @@ HRESULT DSOUND_PrimaryDestroy(DirectSoundDevice *device)
 {
 	TRACE("(%p)\n", device);
 
+        EnterCriticalSection(&(device->mixlock));
+
 	DSOUND_PrimaryClose(device);
 	if (device->driver) {
 		if (device->hwbuf) {
@@ -227,6 +229,7 @@ HRESULT DSOUND_PrimaryDestroy(DirectSoundDevice *device)
 	}
         HeapFree(GetProcessHeap(),0,device->pwfx);
         device->pwfx=NULL;
+        LeaveCriticalSection(&(device->mixlock));
 	return DS_OK;
 }
 
@@ -253,6 +256,7 @@ HRESULT DSOUND_PrimaryStop(DirectSoundDevice *device)
 	HRESULT err = DS_OK;
 	TRACE("(%p)\n", device);
 
+	EnterCriticalSection(&(device->mixlock));
 	if (device->hwbuf) {
 		err = IDsDriverBuffer_Stop(device->hwbuf);
 		if (err == DSERR_BUFFERLOST) {
@@ -285,6 +289,7 @@ HRESULT DSOUND_PrimaryStop(DirectSoundDevice *device)
 		if (err != DS_OK)
 			WARN("waveOutPause failed\n");
 	}
+	LeaveCriticalSection(&(device->mixlock));
 	return err;
 }
 




More information about the wine-cvs mailing list