[gnome-shell] dbus: Avoid losing org.freedesktop.Notifications on replacement



commit 42e26a86821fd961d09310e8740d3b3fb26b0247
Author: Colin Walters <walters verbum org>
Date:   Wed Mar 30 14:34:42 2011 -0400

    dbus: Avoid losing org.freedesktop.Notifications on replacement
    
    We weren't specifying _ALLOW_REPLACEMENT for anything except
    org.gnome.Shell, which created a race - if the exiting process
    didn't exit fast enough, the replacing process would fail
    to get the name.
    
    https://bugzilla.gnome.org/show_bug.cgi?id=646257

 src/main.c |   15 +++++++--------
 1 files changed, 7 insertions(+), 8 deletions(-)
---
diff --git a/src/main.c b/src/main.c
index 589b27f..5472953 100644
--- a/src/main.c
+++ b/src/main.c
@@ -73,13 +73,10 @@ shell_dbus_init (gboolean replace)
       exit (1);
     }
 
-  /* Also grab org.gnome.Panel to replace any existing panel process,
-   * unless a special environment variable is passed.  The environment
-   * variable is used by the gnome-shell (no --replace) launcher in
-   * Xephyr */
+  /* Also grab org.gnome.Panel to replace any existing panel process */
   if (!dbus_g_proxy_call (bus, "RequestName", &error, G_TYPE_STRING,
                           "org.gnome.Panel", G_TYPE_UINT,
-                          DBUS_NAME_FLAG_REPLACE_EXISTING | DBUS_NAME_FLAG_DO_NOT_QUEUE,
+                          DBUS_NAME_FLAG_REPLACE_EXISTING | request_name_flags,
                           G_TYPE_INVALID, G_TYPE_UINT,
                           &request_name_result, G_TYPE_INVALID))
     {
@@ -91,7 +88,7 @@ shell_dbus_init (gboolean replace)
    */
   if (!dbus_g_proxy_call (bus, "RequestName", &error,
                           G_TYPE_STRING, MAGNIFIER_DBUS_SERVICE,
-                          G_TYPE_UINT, 0,
+                          G_TYPE_UINT, DBUS_NAME_FLAG_REPLACE_EXISTING | request_name_flags,
                           G_TYPE_INVALID,
                           G_TYPE_UINT, &request_name_result,
                           G_TYPE_INVALID))
@@ -101,11 +98,13 @@ shell_dbus_init (gboolean replace)
        * but keep going. */
     }
 
-  /* ...and the org.freedesktop.Notifications service.
+  /* ...and the org.freedesktop.Notifications service; we always
+   * specify REPLACE_EXISTING to ensure we kill off
+   * notification-daemon if it was running.
    */
   if (!dbus_g_proxy_call (bus, "RequestName", &error,
                           G_TYPE_STRING, "org.freedesktop.Notifications",
-                          G_TYPE_UINT, DBUS_NAME_FLAG_REPLACE_EXISTING | DBUS_NAME_FLAG_DO_NOT_QUEUE,
+                          G_TYPE_UINT, DBUS_NAME_FLAG_REPLACE_EXISTING | request_name_flags,
                           G_TYPE_INVALID,
                           G_TYPE_UINT, &request_name_result,
                           G_TYPE_INVALID))



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