mciavi32: Fix a hang when the MCI_WAIT flag is used.

Peter Dons Tychsen (none) donpedro at donpedro.
Sat Aug 29 17:30:04 CDT 2009


---
 dlls/mciavi32/mciavi.c |    8 +++++---
 1 files changed, 5 insertions(+), 3 deletions(-)

diff --git a/dlls/mciavi32/mciavi.c b/dlls/mciavi32/mciavi.c
index 4e5faac..12cce41 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,11 @@ static	DWORD	MCIAVI_mciPlay(UINT wDevID, DWORD dwFlags, LPMCI_PLAY_PARMS lpParms
     /* signal the state change */
     SetEvent(wma->ack_event);
 
+    /* Show the window now. Do not do this before the "ack_event" has been signalled so the main thread is released,
+       as calling ShowWindow() might block the thread causing a deadlock */
+    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);
 
-- 
1.6.2.5


--=-yEQ9HkI+lCMAp6wD4cGW--




More information about the wine-patches mailing list