Paul Gofman : winegstreamer: Create media source read thread after initializing wg_parser.

Alexandre Julliard julliard at winehq.org
Wed Aug 25 15:21:44 CDT 2021


Module: wine
Branch: master
Commit: f49b8602e357957744db95b11d0c187175551833
URL:    https://source.winehq.org/git/wine.git/?a=commit;h=f49b8602e357957744db95b11d0c187175551833

Author: Paul Gofman <pgofman at codeweavers.com>
Date:   Wed Aug 25 14:43:39 2021 +0300

winegstreamer: Create media source read thread after initializing wg_parser.

Fixes race condition as wg_parser is used right away in the created
thread.

Signed-off-by: Paul Gofman <pgofman at codeweavers.com>
Signed-off-by: Zebediah Figura <zfigura at codeweavers.com>
Signed-off-by: Alexandre Julliard <julliard at winehq.org>

---

 dlls/winegstreamer/media_source.c | 4 ++--
 1 file changed, 2 insertions(+), 2 deletions(-)

diff --git a/dlls/winegstreamer/media_source.c b/dlls/winegstreamer/media_source.c
index 05544ef7abe..01ab626254a 100644
--- a/dlls/winegstreamer/media_source.c
+++ b/dlls/winegstreamer/media_source.c
@@ -1315,8 +1315,6 @@ static HRESULT media_source_constructor(IMFByteStream *bytestream, struct media_
     if (FAILED(hr = MFAllocateWorkQueue(&object->async_commands_queue)))
         goto fail;
 
-    object->read_thread = CreateThread(NULL, 0, read_thread, object, 0, NULL);
-
     if (!(parser = unix_funcs->wg_decodebin_parser_create()))
     {
         hr = E_OUTOFMEMORY;
@@ -1324,6 +1322,8 @@ static HRESULT media_source_constructor(IMFByteStream *bytestream, struct media_
     }
     object->wg_parser = parser;
 
+    object->read_thread = CreateThread(NULL, 0, read_thread, object, 0, NULL);
+
     object->state = SOURCE_OPENING;
 
     if (FAILED(hr = unix_funcs->wg_parser_connect(parser, file_size)))




More information about the wine-cvs mailing list