Commit ed0d100e authored by Rémi Bernon's avatar Rémi Bernon Committed by Alexandre Julliard

winegstreamer: Check for already opened stream in wm_reader_open*.

parent 35925856
......@@ -393,21 +393,11 @@ static HRESULT WINAPI WMReader_Open(IWMReader *iface, const WCHAR *url,
reader, debugstr_w(url), callback, context);
EnterCriticalSection(&reader->cs);
EnterCriticalSection(&reader->reader.cs);
if (reader->reader.wg_parser)
{
LeaveCriticalSection(&reader->reader.cs);
LeaveCriticalSection(&reader->cs);
WARN("Stream is already open; returning E_UNEXPECTED.\n");
return E_UNEXPECTED;
}
if (SUCCEEDED(hr = wm_reader_open_file(&reader->reader, url))
&& FAILED(hr = async_reader_open(reader, callback, context)))
wm_reader_close(&reader->reader);
LeaveCriticalSection(&reader->reader.cs);
LeaveCriticalSection(&reader->cs);
return hr;
}
......@@ -873,21 +863,11 @@ static HRESULT WINAPI WMReaderAdvanced2_OpenStream(IWMReaderAdvanced6 *iface,
TRACE("reader %p, stream %p, callback %p, context %p.\n", reader, stream, callback, context);
EnterCriticalSection(&reader->cs);
EnterCriticalSection(&reader->reader.cs);
if (reader->reader.wg_parser)
{
LeaveCriticalSection(&reader->reader.cs);
LeaveCriticalSection(&reader->cs);
WARN("Stream is already open; returning E_UNEXPECTED.\n");
return E_UNEXPECTED;
}
if (SUCCEEDED(hr = wm_reader_open_stream(&reader->reader, stream))
&& FAILED(hr = async_reader_open(reader, callback, context)))
wm_reader_close(&reader->reader);
LeaveCriticalSection(&reader->reader.cs);
LeaveCriticalSection(&reader->cs);
return hr;
}
......
......@@ -1558,6 +1558,13 @@ HRESULT wm_reader_open_stream(struct wm_reader *reader, IStream *stream)
EnterCriticalSection(&reader->cs);
if (reader->wg_parser)
{
LeaveCriticalSection(&reader->cs);
WARN("Stream is already open; returning E_UNEXPECTED.\n");
return E_UNEXPECTED;
}
IStream_AddRef(reader->source_stream = stream);
if (FAILED(hr = init_stream(reader, stat.cbSize.QuadPart)))
{
......@@ -1591,6 +1598,14 @@ HRESULT wm_reader_open_file(struct wm_reader *reader, const WCHAR *filename)
EnterCriticalSection(&reader->cs);
if (reader->wg_parser)
{
LeaveCriticalSection(&reader->cs);
WARN("Stream is already open; returning E_UNEXPECTED.\n");
CloseHandle(file);
return E_UNEXPECTED;
}
reader->file = file;
if (FAILED(hr = init_stream(reader, size.QuadPart)))
......
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