mciavi: fix deadlock

Kirill K. Smirnov lich at math.spbu.ru
Fri Mar 13 19:33:35 CDT 2009


-------------- next part --------------
diff --git a/dlls/mciavi32/mciavi.c b/dlls/mciavi32/mciavi.c
index 4e5faac..1872e60 100644
--- a/dlls/mciavi32/mciavi.c
+++ b/dlls/mciavi32/mciavi.c
@@ -423,9 +423,6 @@ static	DWORD	MCIAVI_mciPlay(UINT wDevID, DWORD dwFlags, LPMCI_PLAY_PARMS lpParms
     if (!(dwFlags & MCI_WAIT))
         return MCIAVI_mciPlay_async(wma, dwFlags, lpParms);
 
-    if (!(GetWindowLongW(wma->hWndPaint, GWL_STYLE) & WS_VISIBLE))
-        ShowWindow(wma->hWndPaint, SW_SHOWNA);
-
     EnterCriticalSection(&wma->cs);
 
     dwFromFrame = wma->dwCurrVideoFrame;
@@ -464,6 +461,10 @@ static	DWORD	MCIAVI_mciPlay(UINT wDevID, DWORD dwFlags, LPMCI_PLAY_PARMS lpParms
     /* signal the state change */
     SetEvent(wma->ack_event);
 
+    /* To avoid deadlock deal with the window only after the owning thread is notified by ack_event. */
+    if (!(GetWindowLongW(wma->hWndPaint, GWL_STYLE) & WS_VISIBLE))
+        ShowWindow(wma->hWndPaint, SW_SHOWNA);
+
     if (dwFlags & (MCI_DGV_PLAY_REPEAT|MCI_DGV_PLAY_REVERSE|MCI_MCIAVI_PLAY_WINDOW|MCI_MCIAVI_PLAY_FULLSCREEN))
 	FIXME("Unsupported flag %08x\n", dwFlags);
 


More information about the wine-patches mailing list