From b3a33f065d7e96cb24624560ce05733860e3ecba Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?R=C3=A9mi=20Bernon?= Date: Thu, 26 Mar 2020 00:03:18 +0100 Subject: [PATCH] winegstreamer: Check the callback list before waiting. MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit 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 Signed-off-by: Zebediah Figura Signed-off-by: Alexandre Julliard --- 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 a0618798d89..bf7103b1606 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);