[maemo-commits] [maemo-commits] r14943 - in projects/haf/trunk/gconf2: . debian gconf

From: subversion at stage.maemo.org subversion at stage.maemo.org
Date: Tue Dec 11 10:54:38 EET 2007
Author: richard
Date: 2007-12-11 10:54:34 +0200 (Tue, 11 Dec 2007)
New Revision: 14943

Modified:
   projects/haf/trunk/gconf2/ChangeLog
   projects/haf/trunk/gconf2/debian/changelog
   projects/haf/trunk/gconf2/gconf/gconf-dbus.c
Log:
NB#76693

Modified: projects/haf/trunk/gconf2/ChangeLog
===================================================================
--- projects/haf/trunk/gconf2/ChangeLog	2007-12-10 13:04:29 UTC (rev 14942)
+++ projects/haf/trunk/gconf2/ChangeLog	2007-12-11 08:54:34 UTC (rev 14943)
@@ -1,3 +1,9 @@
+2007-12-11  Richard Hult  <richard at imendio.com>
+
+	* gconf/gconf-dbus.c: (ensure_dbus_connection),
+	(gconf_dbus_message_filter): Warn instead of exit when we get
+	disconnected from the bus, NB#76693.
+
 2007-11-10  Richard Hult  <richard at imendio.com>
 
 	* gconf/gconf-dbus.c: (gconf_handle_dbus_exception),

Modified: projects/haf/trunk/gconf2/debian/changelog
===================================================================
--- projects/haf/trunk/gconf2/debian/changelog	2007-12-10 13:04:29 UTC (rev 14942)
+++ projects/haf/trunk/gconf2/debian/changelog	2007-12-11 08:54:34 UTC (rev 14943)
@@ -1,3 +1,9 @@
+gconf2 (2.16.0-1osso10) unstable; urgency=low
+
+  * Fixes: NB#76693, GConf client library forces application exit if D-BUS
+
+ -- Richard Hult <richard at imendio.com>  Fri, 11 Dec 2007 09:17:24 +0100
+
 gconf2 (2.16.0-1osso9) unstable; urgency=low
 
   * Fixes: NB#70845, Leak in GConf client side library

Modified: projects/haf/trunk/gconf2/gconf/gconf-dbus.c
===================================================================
--- projects/haf/trunk/gconf2/gconf/gconf-dbus.c	2007-12-10 13:04:29 UTC (rev 14942)
+++ projects/haf/trunk/gconf2/gconf/gconf-dbus.c	2007-12-11 08:54:34 UTC (rev 14943)
@@ -46,6 +46,8 @@
     "type='signal',member='NameOwnerChanged',arg0='org.gnome.GConf'"
 #define NOTIFY_RULE \
     "type='method_call',interface='org.gnome.GConf.Database'"
+#define DAEMON_DISCONNECTED_RULE \
+    "type='signal',member='Disconnected'"
 
 struct _GConfEngine {
   guint refcount;
@@ -103,6 +105,7 @@
 static GConfEngine    *default_engine = NULL;
 static GHashTable     *engines_by_db = NULL;
 static GHashTable     *engines_by_address = NULL;
+static gboolean        dbus_disconnected = FALSE;
 
 static gboolean     ensure_dbus_connection      (void);
 static gboolean     ensure_service              (gboolean          start_if_not_found,
@@ -390,7 +393,13 @@
 
   if (global_conn != NULL)
     return TRUE;
- 
+
+  if (dbus_disconnected)
+    {
+      g_warning ("The connection to DBus was broken. Can't reinitialize it.");
+      return FALSE;
+    }
+
   dbus_error_init (&error);
 
 #ifdef USE_SYSTEM_BUS
@@ -409,8 +418,11 @@
 	
   dbus_connection_setup_with_g_main (global_conn, NULL);
 
+  dbus_connection_set_exit_on_disconnect (global_conn, FALSE);
+
   dbus_bus_add_match (global_conn, DAEMON_NAME_OWNER_CHANGED_RULE, NULL);
   dbus_bus_add_match (global_conn, NOTIFY_RULE, NULL);
+  dbus_bus_add_match (global_conn, DAEMON_DISCONNECTED_RULE, NULL);
 
   dbus_connection_add_filter (global_conn, gconf_dbus_message_filter,
 			      NULL, NULL);
@@ -2241,17 +2253,14 @@
 				   DBUS_INTERFACE_LOCAL,
 				   "Disconnected"))
     {
-      /* Note: This is a terminal situation. We can't live without the bus and
-       * we don't support starting it after the client. We could add support for
-       * that though.
-       */
-
       dbus_connection_unref (global_conn);
       global_conn = NULL;
       service_running = FALSE;
-            
-      d(g_print ("****** Disconnected!\n"));
-      return DBUS_HANDLER_RESULT_NOT_YET_HANDLED;      
+      dbus_disconnected = TRUE;
+
+      g_warning ("Got Disconnected from DBus.\n");
+
+      return DBUS_HANDLER_RESULT_NOT_YET_HANDLED;
     }
   else if (dbus_message_is_signal (message,
 				   DBUS_INTERFACE_DBUS,


More information about the maemo-commits mailing list