[gnome-builder] subprocess: always pump default main context in main thread



commit 9327dd0c35e35bfc7a81ad4e07781c2d4be7254b
Author: Christian Hergert <chergert redhat com>
Date:   Fri Sep 16 12:42:14 2016 -0700

    subprocess: always pump default main context in main thread
    
    If we are in the main thread (ie: the gtk thread), we want to pump the
    real main loop rather than our own main context. This keeps gtk responsive
    should it be necessary as well as ensures that we will get our dispatch
    called (which could end up having landed on the primary main context).

 libide/subprocess/ide-breakout-subprocess.c |    7 ++++++-
 1 files changed, 6 insertions(+), 1 deletions(-)
---
diff --git a/libide/subprocess/ide-breakout-subprocess.c b/libide/subprocess/ide-breakout-subprocess.c
index 46fd81e..3b1fb67 100644
--- a/libide/subprocess/ide-breakout-subprocess.c
+++ b/libide/subprocess/ide-breakout-subprocess.c
@@ -536,7 +536,12 @@ ide_breakout_subprocess_sync_complete (IdeBreakoutSubprocess  *self,
   g_assert (*result == NULL || G_IS_ASYNC_RESULT (*result));
 
   if (NULL == (main_context = g_main_context_get_thread_default ()))
-    main_context = free_me = g_main_context_new ();
+    {
+      if (IDE_IS_MAIN_THREAD ())
+        main_context = g_main_context_default ();
+      else
+        main_context = free_me = g_main_context_new ();
+    }
 
   g_mutex_lock (&self->waiter_mutex);
   self->main_context = g_main_context_ref (main_context);


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