Commit 78f916f5 authored by Zebediah Figura's avatar Zebediah Figura Committed by Alexandre Julliard

winegstreamer: Return E_UNEXPECTED when calling IWMReader::Stop() if no stream is open.

parent 4a206a7e
......@@ -356,6 +356,14 @@ static HRESULT WINAPI WMReader_Stop(IWMReader *iface)
TRACE("reader %p.\n", reader);
EnterCriticalSection(&reader->reader.cs);
if (!reader->reader.wg_parser)
{
LeaveCriticalSection(&reader->reader.cs);
WARN("No stream is open; returning E_UNEXPECTED.\n");
return E_UNEXPECTED;
}
stop_streaming(reader);
IWMReaderCallback_OnStatus(reader->callback, WMT_STOPPED, S_OK,
WMT_TYPE_DWORD, (BYTE *)&zero, reader->context);
......
......@@ -2169,6 +2169,9 @@ static void test_async_reader_streaming(void)
IWMReader_QueryInterface(reader, &IID_IWMProfile, (void **)&profile);
IWMReader_QueryInterface(reader, &IID_IWMReaderAdvanced2, (void **)&advanced);
hr = IWMReader_Stop(reader);
ok(hr == E_UNEXPECTED, "Got hr %#x.\n", hr);
hr = IWMReaderAdvanced2_OpenStream(advanced, &stream.IStream_iface, &callback.IWMReaderCallback_iface, (void **)0xdeadbeef);
ok(hr == S_OK, "Got hr %#x.\n", hr);
ok(stream.refcount > 1, "Got refcount %d.\n", stream.refcount);
......@@ -2257,6 +2260,9 @@ static void test_async_reader_streaming(void)
ok(callback.refcount == 1, "Got outstanding refcount %d.\n", callback.refcount);
callback_cleanup(&callback);
hr = IWMReader_Stop(reader);
ok(hr == E_UNEXPECTED, "Got hr %#x.\n", hr);
ok(stream.refcount == 1, "Got outstanding refcount %d.\n", stream.refcount);
CloseHandle(stream.file);
ret = DeleteFileW(filename);
......
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