winegstreamer: Disconnect source pins before calling wg_parser_disconnect().

Signed-off-by: Zebediah Figura <zfigura@codeweavers.com>
Signed-off-by: Alexandre Julliard <julliard@winehq.org>
This commit is contained in:
Zebediah Figura 2022-04-04 11:50:54 -05:00 committed by Alexandre Julliard
parent 5885f20c4a
commit db41b2ae23
1 changed files with 9 additions and 6 deletions

View File

@ -1629,6 +1629,15 @@ static HRESULT GST_RemoveOutputPins(struct parser *This)
if (!This->sink_connected)
return S_OK;
/* Disconnecting source pins triggers a call to wg_parser_stream_disable().
* The stream pointers are no longer valid after wg_parser_disconnect(), so
* make sure we disable the streams first. */
for (i = 0; i < This->source_count; ++i)
{
if (This->sources[i])
free_source_pin(This->sources[i]);
}
wg_parser_disconnect(This->wg_parser);
/* read_thread() needs to stay alive to service any read requests GStreamer
@ -1637,12 +1646,6 @@ static HRESULT GST_RemoveOutputPins(struct parser *This)
WaitForSingleObject(This->read_thread, INFINITE);
CloseHandle(This->read_thread);
for (i = 0; i < This->source_count; ++i)
{
if (This->sources[i])
free_source_pin(This->sources[i]);
}
This->source_count = 0;
free(This->sources);
This->sources = NULL;