winmm: Fix midi deadlock by not holding lock on release.
This commit is contained in:
parent
3120c0861c
commit
15907b5035
|
@ -1767,19 +1767,25 @@ static DWORD MCI_Close(UINT16 wDevID, DWORD dwParam, LPMCI_GENERIC_PARMS lpParms
|
||||||
TRACE("(%04x, %08X, %p)\n", wDevID, dwParam, lpParms);
|
TRACE("(%04x, %08X, %p)\n", wDevID, dwParam, lpParms);
|
||||||
|
|
||||||
if (wDevID == MCI_ALL_DEVICE_ID) {
|
if (wDevID == MCI_ALL_DEVICE_ID) {
|
||||||
LPWINE_MCIDRIVER next;
|
|
||||||
|
|
||||||
EnterCriticalSection(&WINMM_cs);
|
|
||||||
/* FIXME: shall I notify once after all is done, or for
|
/* FIXME: shall I notify once after all is done, or for
|
||||||
* each of the open drivers ? if the latest, which notif
|
* each of the open drivers ? if the latest, which notif
|
||||||
* to return when only one fails ?
|
* to return when only one fails ?
|
||||||
*/
|
*/
|
||||||
for (wmd = MciDrivers; wmd; ) {
|
while (MciDrivers) {
|
||||||
next = wmd->lpNext;
|
/* Retrieve the device ID under lock, but send the message without,
|
||||||
MCI_Close(wmd->wDeviceID, dwParam, lpParms);
|
* the driver might be calling some winmm functions from another
|
||||||
wmd = next;
|
* thread before being fully stopped.
|
||||||
|
*/
|
||||||
|
EnterCriticalSection(&WINMM_cs);
|
||||||
|
if (!MciDrivers)
|
||||||
|
{
|
||||||
|
LeaveCriticalSection(&WINMM_cs);
|
||||||
|
break;
|
||||||
|
}
|
||||||
|
wDevID = MciDrivers->wDeviceID;
|
||||||
|
LeaveCriticalSection(&WINMM_cs);
|
||||||
|
MCI_Close(wDevID, dwParam, lpParms);
|
||||||
}
|
}
|
||||||
LeaveCriticalSection(&WINMM_cs);
|
|
||||||
return 0;
|
return 0;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
Loading…
Reference in New Issue