[glib/glib-2-50] gmain: Signal wakeups if context has never been acquired as well



commit c4b3fd1487dad9dece67453cef4954b07dd3bdc1
Author: Paolo Bonzini <bonzini gnu org>
Date:   Mon Apr 3 13:32:32 2017 -0400

    gmain: Signal wakeups if context has never been acquired as well
    
    Should address backwards compatibility with how qemu is using
    `GMainContext`.
    
    See https://bugzilla.gnome.org/show_bug.cgi?id=761102#c14
    
    Input-into-keyboard-by: Colin Walters <walters verbum org>

 glib/gmain.c |   12 +++++++++++-
 1 files changed, 11 insertions(+), 1 deletions(-)
---
diff --git a/glib/gmain.c b/glib/gmain.c
index 88b57fd..f390c46 100644
--- a/glib/gmain.c
+++ b/glib/gmain.c
@@ -1127,7 +1127,17 @@ source_remove_from_context (GSource      *source,
 static void
 conditional_wakeup (GMainContext *context)
 {
-  if (context->owner && context->owner != G_THREAD_SELF)
+  /* We want to signal wakeups in two cases:
+   *  1 When the context is owned by another thread
+   *  2 When the context owner is NULL (two subcases)
+   *   2a Possible if the context has never been acquired
+   *   2b Or if the context has no current owner
+   *
+   * At least case 2a) is necessary to ensure backwards compatibility with
+   * qemu's use of GMainContext.
+   * https://bugzilla.gnome.org/show_bug.cgi?id=761102#c14
+   */
+  if (context->owner != G_THREAD_SELF)
     g_wakeup_signal (context->wakeup);
 }
 


[Date Prev][Date Next]   [Thread Prev][Thread Next]   [Thread Index] [Date Index] [Author Index]