Rémi Bernon : winegstreamer: Check the callback list before waiting.

Alexandre Julliard julliard at winehq.org
Thu Mar 26 16:27:25 CDT 2020


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

Author: Rémi Bernon <rbernon at codeweavers.com>
Date:   Thu Mar 26 00:03:18 2020 +0100

winegstreamer: Check the callback list before waiting.

Some callbacks may be pushed during pipeline initialization and before
the dispatch thread is actually started and waiting for them, which
sometimes causes some hangs.

This fixes Fallout 3 and Panzer Corps -and possibly others- intro videos
hanging forever.

Signed-off-by: Rémi Bernon <rbernon at codeweavers.com>
Signed-off-by: Zebediah Figura <zfigura at codeweavers.com>
Signed-off-by: Alexandre Julliard <julliard at winehq.org>

---

 dlls/winegstreamer/gst_cbs.c | 12 ++++--------
 1 file changed, 4 insertions(+), 8 deletions(-)

diff --git a/dlls/winegstreamer/gst_cbs.c b/dlls/winegstreamer/gst_cbs.c
index a0618798d8..bf7103b160 100644
--- a/dlls/winegstreamer/gst_cbs.c
+++ b/dlls/winegstreamer/gst_cbs.c
@@ -66,15 +66,11 @@ static DWORD WINAPI dispatch_thread(void *user)
 
     while (1)
     {
-        pthread_cond_wait(&cb_list_cond, &cb_list_lock);
+        while (list_empty(&cb_list)) pthread_cond_wait(&cb_list_cond, &cb_list_lock);
 
-        while (!list_empty(&cb_list))
-        {
-            cbdata = LIST_ENTRY(list_head(&cb_list), struct cb_data, entry);
-            list_remove(&cbdata->entry);
-
-            TrySubmitThreadpoolCallback(&perform_cb, cbdata, NULL);
-        }
+        cbdata = LIST_ENTRY(list_head(&cb_list), struct cb_data, entry);
+        list_remove(&cbdata->entry);
+        TrySubmitThreadpoolCallback(&perform_cb, cbdata, NULL);
     }
 
     pthread_mutex_unlock(&cb_list_lock);




More information about the wine-cvs mailing list