Commit 0d1cba8e authored by Christian Costa's avatar Christian Costa Committed by Alexandre Julliard

mciqtz32: Only call CoUninitialize when CoInitializeEx succeeds.

parent 281f7018
...@@ -153,7 +153,8 @@ static DWORD MCIQTZ_mciOpen(UINT wDevID, DWORD dwFlags, ...@@ -153,7 +153,8 @@ static DWORD MCIQTZ_mciOpen(UINT wDevID, DWORD dwFlags,
MCIQTZ_mciStop(wDevID, MCI_WAIT, NULL); MCIQTZ_mciStop(wDevID, MCI_WAIT, NULL);
CoInitializeEx(NULL, COINIT_MULTITHREADED); hr = CoInitializeEx(NULL, COINIT_MULTITHREADED);
wma->uninit = SUCCEEDED(hr);
hr = CoCreateInstance(&CLSID_FilterGraph, NULL, CLSCTX_INPROC_SERVER, &IID_IGraphBuilder, (LPVOID*)&wma->pgraph); hr = CoCreateInstance(&CLSID_FilterGraph, NULL, CLSCTX_INPROC_SERVER, &IID_IGraphBuilder, (LPVOID*)&wma->pgraph);
if (FAILED(hr)) { if (FAILED(hr)) {
...@@ -197,7 +198,8 @@ err: ...@@ -197,7 +198,8 @@ err:
IMediaControl_Release(wma->pmctrl); IMediaControl_Release(wma->pmctrl);
wma->pmctrl = NULL; wma->pmctrl = NULL;
CoUninitialize(); if (wma->uninit)
CoUninitialize();
return MCIERR_INTERNAL; return MCIERR_INTERNAL;
} }
...@@ -220,7 +222,8 @@ static DWORD MCIQTZ_mciClose(UINT wDevID, DWORD dwFlags, LPMCI_GENERIC_PARMS lpP ...@@ -220,7 +222,8 @@ static DWORD MCIQTZ_mciClose(UINT wDevID, DWORD dwFlags, LPMCI_GENERIC_PARMS lpP
if (wma->opened) { if (wma->opened) {
IGraphBuilder_Release(wma->pgraph); IGraphBuilder_Release(wma->pgraph);
IMediaControl_Release(wma->pmctrl); IMediaControl_Release(wma->pmctrl);
CoUninitialize(); if (wma->uninit)
CoUninitialize();
wma->opened = FALSE; wma->opened = FALSE;
} }
......
...@@ -28,6 +28,7 @@ ...@@ -28,6 +28,7 @@
typedef struct { typedef struct {
MCIDEVICEID wDevID; MCIDEVICEID wDevID;
BOOL opened; BOOL opened;
BOOL uninit;
IGraphBuilder* pgraph; IGraphBuilder* pgraph;
IMediaControl* pmctrl; IMediaControl* pmctrl;
BOOL started; BOOL started;
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment