Christian Costa : mciqtz32: Use opened state to avoid device to be closed several times.

Alexandre Julliard julliard at winehq.org
Mon Apr 20 11:33:09 CDT 2009


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

Author: Christian Costa <titan.costa at wanadoo.fr>
Date:   Thu Apr 16 20:29:00 2009 +0200

mciqtz32: Use opened state to avoid device to be closed several times.

---

 dlls/mciqtz32/mciqtz.c         |   12 ++++++------
 dlls/mciqtz32/mciqtz_private.h |    1 +
 2 files changed, 7 insertions(+), 6 deletions(-)

diff --git a/dlls/mciqtz32/mciqtz.c b/dlls/mciqtz32/mciqtz.c
index 0cd973b..da3e09a 100644
--- a/dlls/mciqtz32/mciqtz.c
+++ b/dlls/mciqtz32/mciqtz.c
@@ -185,6 +185,8 @@ static DWORD MCIQTZ_mciOpen(UINT wDevID, DWORD dwFlags,
         goto err;
     }
 
+    wma->opened = TRUE;
+
     return 0;
 
 err:
@@ -215,14 +217,12 @@ static DWORD MCIQTZ_mciClose(UINT wDevID, DWORD dwFlags, LPMCI_GENERIC_PARMS lpP
     if (!wma)
         return MCIERR_INVALID_DEVICE_ID;
 
-    if (wma->pgraph)
+    if (wma->opened) {
         IGraphBuilder_Release(wma->pgraph);
-    wma->pgraph = NULL;
-    if (wma->pmctrl)
         IMediaControl_Release(wma->pmctrl);
-    wma->pmctrl = NULL;
-
-    CoUninitialize();
+        CoUninitialize();
+        wma->opened = FALSE;
+    }
 
     return 0;
 }
diff --git a/dlls/mciqtz32/mciqtz_private.h b/dlls/mciqtz32/mciqtz_private.h
index cbcece0..23945a4 100644
--- a/dlls/mciqtz32/mciqtz_private.h
+++ b/dlls/mciqtz32/mciqtz_private.h
@@ -27,6 +27,7 @@
 
 typedef struct {
     MCIDEVICEID    wDevID;
+    BOOL           opened;
     IGraphBuilder* pgraph;
     IMediaControl* pmctrl;
     BOOL           started;




More information about the wine-cvs mailing list