[gnome-builder/wip/chergert/multi-process] app: delay message processing until the worker has registered



commit a89f9deb117ce4a1d11d61e2907c9f8ff683ecd9
Author: Christian Hergert <chergert redhat com>
Date:   Wed Oct 21 10:19:57 2015 -0700

    app: delay message processing until the worker has registered
    
    We don't want to start processing messages until our service has been
    registered on the connection, otherwise we could miss messages.

 src/app/gb-application.c |   12 +++++++++---
 1 files changed, 9 insertions(+), 3 deletions(-)
---
diff --git a/src/app/gb-application.c b/src/app/gb-application.c
index 2351a6e..c921a27 100644
--- a/src/app/gb-application.c
+++ b/src/app/gb-application.c
@@ -74,7 +74,8 @@ gb_application_load_worker (GbApplication *self)
   IDE_TRACE_MSG ("Connecting to %s", self->dbus_address);
 
   connection = g_dbus_connection_new_for_address_sync (self->dbus_address,
-                                                       G_DBUS_CONNECTION_FLAGS_AUTHENTICATION_CLIENT,
+                                                       (G_DBUS_CONNECTION_FLAGS_AUTHENTICATION_CLIENT |
+                                                        G_DBUS_CONNECTION_FLAGS_DELAY_MESSAGE_PROCESSING),
                                                        NULL, NULL, &error);
 
   if (error != NULL)
@@ -98,14 +99,19 @@ gb_application_load_worker (GbApplication *self)
       if (exten != NULL)
         {
           ide_worker_register_service (IDE_WORKER (exten), connection);
-          g_application_hold (G_APPLICATION (self));
-          IDE_EXIT;
+          IDE_GOTO (success);
         }
     }
 
   g_error ("Failed to create \"%s\" worker.", self->type);
 
   IDE_EXIT;
+
+success:
+  g_application_hold (G_APPLICATION (self));
+  g_dbus_connection_start_message_processing (connection);
+
+  IDE_EXIT;
 }
 
 static void


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