From: Rémi Bernon rbernon@codeweavers.com
Signed-off-by: Rémi Bernon rbernon@codeweavers.com --- dlls/winegstreamer/wm_asyncreader.c | 7 +++++++ dlls/wmvcore/tests/wmvcore.c | 3 +++ 2 files changed, 10 insertions(+)
diff --git a/dlls/winegstreamer/wm_asyncreader.c b/dlls/winegstreamer/wm_asyncreader.c index df7c701f6f0..e70498b9858 100644 --- a/dlls/winegstreamer/wm_asyncreader.c +++ b/dlls/winegstreamer/wm_asyncreader.c @@ -222,6 +222,13 @@ static HRESULT WINAPI WMReader_Open(IWMReader *iface, const WCHAR *url,
EnterCriticalSection(&reader->reader.cs);
+ if (reader->reader.wg_parser) + { + LeaveCriticalSection(&reader->reader.cs); + WARN("Stream is already open; returning E_UNEXPECTED.\n"); + return E_UNEXPECTED; + } + if (SUCCEEDED(hr = wm_reader_open_file(&reader->reader, url))) open_stream(reader, callback, context);
diff --git a/dlls/wmvcore/tests/wmvcore.c b/dlls/wmvcore/tests/wmvcore.c index 315173b9860..59d1f5abcc6 100644 --- a/dlls/wmvcore/tests/wmvcore.c +++ b/dlls/wmvcore/tests/wmvcore.c @@ -2541,6 +2541,9 @@ static void test_async_reader_file(void) ret = WaitForSingleObject(callback.got_opened, 1000); ok(!ret, "Wait timed out.\n");
+ hr = IWMReader_Open(reader, filename, &callback.IWMReaderCallback_iface, (void **)0xdeadbee0); + ok(hr == E_UNEXPECTED, "Got hr %#lx.\n", hr); + count = 0xdeadbeef; hr = IWMReader_GetOutputCount(reader, &count); ok(hr == S_OK, "Got hr %#lx.\n", hr);