[MCIAVI] Protect some more wave calls
Christian Costa
titan.costa at wanadoo.fr
Wed Mar 17 13:04:32 CST 2004
Hi,
This is the same as one my recent patch but with other remaining wave calls.
Changelog :
Release lock before wave calls that generate notification.
Christian Costa titan.costa at wanadoo.fr
-------------- next part --------------
Index: mciavi.c
===================================================================
RCS file: /home/wine/wine/dlls/winmm/mciavi/mciavi.c,v
retrieving revision 1.24
diff -u -r1.24 mciavi.c
--- mciavi.c 16 Mar 2004 01:13:52 -0000 1.24
+++ mciavi.c 17 Mar 2004 17:52:49 -0000
@@ -536,7 +536,9 @@
}
/* just to get rid of some race conditions between play, stop and pause */
+ LeaveCriticalSection(&wma->cs);
waveOutReset(wma->hWave);
+ EnterCriticalSection(&wma->cs);
for (i = 0; i < nHdr; i++)
waveOutUnprepareHeader(wma->hWave, &waveHdr[i], sizeof(WAVEHDR));
@@ -548,7 +550,9 @@
HeapFree(GetProcessHeap(), 0, waveHdr);
if (wma->hWave) {
+ LeaveCriticalSection(&wma->cs);
waveOutClose(wma->hWave);
+ EnterCriticalSection(&wma->cs);
wma->hWave = 0;
}
CloseHandle(wma->hEvent);
@@ -643,7 +647,6 @@
static DWORD MCIAVI_mciPause(UINT wDevID, DWORD dwFlags, LPMCI_GENERIC_PARMS lpParms)
{
WINE_MCIAVI *wma;
- DWORD ret;
wma = MCIAVI_mciGetOpenDev(wDevID);
if (wma == NULL) return MCIERR_INVALID_DEVICE_ID;
@@ -653,10 +656,13 @@
if (wma->dwStatus == MCI_MODE_PLAY)
wma->dwStatus = MCI_MODE_PAUSE;
- ret = (wma->lpWaveFormat) ? waveOutPause(wma->hWave) : 0;
-
+ if (wma->lpWaveFormat) {
+ LeaveCriticalSection(&wma->cs);
+ return waveOutPause(wma->hWave);
+ }
+
LeaveCriticalSection(&wma->cs);
- return ret;
+ return 0;
}
/***************************************************************************
@@ -665,9 +671,8 @@
static DWORD MCIAVI_mciResume(UINT wDevID, DWORD dwFlags, LPMCI_GENERIC_PARMS lpParms)
{
WINE_MCIAVI *wma;
- DWORD ret;
- FIXME("(%04x, %08lX, %p) : stub\n", wDevID, dwFlags, lpParms);
+ TRACE("(%04x, %08lX, %p)\n", wDevID, dwFlags, lpParms);
wma = MCIAVI_mciGetOpenDev(wDevID);
if (wma == NULL) return MCIERR_INVALID_DEVICE_ID;
@@ -677,10 +682,13 @@
if (wma->dwStatus == MCI_MODE_PAUSE)
wma->dwStatus = MCI_MODE_PLAY;
- ret = (wma->lpWaveFormat) ? waveOutRestart(wma->hWave) : 0;
+ if (wma->lpWaveFormat) {
+ LeaveCriticalSection(&wma->cs);
+ return waveOutRestart(wma->hWave);
+ }
LeaveCriticalSection(&wma->cs);
- return ret;
+ return 0;
}
/***************************************************************************
More information about the wine-patches
mailing list