[glib] gdesktopappinfo: Asynchronously flush after sending notification



commit d6954c785d635be875b896ac9f4812e400b39455
Author: Colin Walters <walters verbum org>
Date:   Fri Feb 4 15:37:51 2011 -0500

    gdesktopappinfo: Asynchronously flush after sending notification
    
    If we were the initial connection owner, unref will destroy the
    connection immediately, and we may lose messages.  Asynchronously
    flush to avoid that.
    
    https://bugzilla.gnome.org/show_bug.cgi?id=641411

 gio/gdesktopappinfo.c |    9 ++++++++-
 1 files changed, 8 insertions(+), 1 deletions(-)
---
diff --git a/gio/gdesktopappinfo.c b/gio/gdesktopappinfo.c
index f557538..1fe5ecf 100644
--- a/gio/gdesktopappinfo.c
+++ b/gio/gdesktopappinfo.c
@@ -1096,7 +1096,14 @@ _g_desktop_app_info_launch_uris_internal (GAppInfo                   *appinfo,
    * after launching an app.  See http://bugzilla.gnome.org/606960
    */
   if (session_bus != NULL)
-    g_object_unref (session_bus);
+    {
+      /* This asynchronous flush holds a reference until it completes,
+       * which ensures that the following unref won't immediately kill
+       * the connection if we were the initial owner.
+       */
+      g_dbus_connection_flush (session_bus, NULL, NULL, NULL);
+      g_object_unref (session_bus);
+    }
 
   completed = TRUE;
 



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