dbus/dbus dbus-bus.c, 1.50, 1.51 dbus-bus.h, 1.16, 1.17 dbus-connection.c, 1.118, 1.119 dbus-connection.h, 1.40, 1.41

John Palmieri johnp at kemper.freedesktop.org
Fri Jul 7 12:42:58 PDT 2006


Update of /cvs/dbus/dbus/dbus
In directory kemper:/tmp/cvs-serv2751/dbus

Modified Files:
	dbus-bus.c dbus-bus.h dbus-connection.c dbus-connection.h 
Log Message:
* dbus/dbus-connection.c (dbus_connection_close): removed deprecated
  function
  (dbus_connection_dispatch): On disconnect unref any shared connections

* dbus/dbus-bus.c (_dbus_bus_check_connection_and_unref): new function
  for cleaning up shared connections on disconnect
  (internal_bus_get): get a hard refrence to shared connections when
  they are created
	
* doc/TODO: Remove items which are no longer relevent or have been fixed
  Split 1.0 todo items with a 0.90 freeze todo list


Index: dbus-bus.c
===================================================================
RCS file: /cvs/dbus/dbus/dbus/dbus-bus.c,v
retrieving revision 1.50
retrieving revision 1.51
diff -u -d -r1.50 -r1.51
--- dbus-bus.c	3 May 2006 22:56:35 -0000	1.50
+++ dbus-bus.c	7 Jul 2006 19:42:56 -0000	1.51
@@ -302,6 +302,23 @@
   return bd;
 }
 
+/* internal function that checks to see if this
+   is a shared bus connection and if it is unref it */
+void
+_dbus_bus_check_connection_and_unref (DBusConnection *connection)
+{
+  if (bus_connections[DBUS_BUS_SYSTEM] == connection)
+    {
+      bus_connections[DBUS_BUS_SYSTEM] = NULL;
+      dbus_connection_unref (connection);
+    }
+  else if (bus_connections[DBUS_BUS_SESSION] == connection)
+    {
+      bus_connections[DBUS_BUS_SESSION] = NULL;
+      dbus_connection_unref (connection);
+    }
+}
+
 static DBusConnection *
 internal_bus_get (DBusBusType  type,
 	      DBusError   *error, dbus_bool_t private)
@@ -385,7 +402,11 @@
     }
 
   if (!private)
-    bus_connections[type] = connection;
+    {
+      /* get a hard ref to the connection */
+      bus_connections[type] = connection;
+      dbus_connection_ref (bus_connections[type]);
+    }
   
   bd = ensure_bus_data (connection);
   _dbus_assert (bd != NULL);

Index: dbus-bus.h
===================================================================
RCS file: /cvs/dbus/dbus/dbus/dbus-bus.h,v
retrieving revision 1.16
retrieving revision 1.17
diff -u -d -r1.16 -r1.17
--- dbus-bus.h	15 Nov 2005 17:19:19 -0000	1.16
+++ dbus-bus.h	7 Jul 2006 19:42:56 -0000	1.17
@@ -68,6 +68,8 @@
                                            const char     *rule,
                                            DBusError      *error);
 
+void           _dbus_bus_check_connection_and_unref (DBusConnection *connection);
+
 DBUS_END_DECLS
 
 #endif /* DBUS_BUS_H */

Index: dbus-connection.c
===================================================================
RCS file: /cvs/dbus/dbus/dbus/dbus-connection.c,v
retrieving revision 1.118
retrieving revision 1.119
diff -u -d -r1.118 -r1.119
--- dbus-connection.c	23 Apr 2006 18:54:47 -0000	1.118
+++ dbus-connection.c	7 Jul 2006 19:42:56 -0000	1.119
@@ -1947,18 +1947,6 @@
   _dbus_connection_update_dispatch_status_and_unlock (connection, status);
 }
 
-/** Alias for dbus_connection_close(). This method is DEPRECATED and will be
- *  removed for 1.0. Change your code to use dbus_connection_close() instead.
- *
- * @param connection the connection.
- * @deprecated
- */
-void
-dbus_connection_disconnect (DBusConnection *connection)
-{
-  dbus_connection_close (connection);
-}
-
 static dbus_bool_t
 _dbus_connection_get_is_connected_unlocked (DBusConnection *connection)
 {
@@ -3780,15 +3768,21 @@
     {
       _dbus_verbose (" ... done dispatching in %s\n", _DBUS_FUNCTION_NAME);
       
-      if (connection->exit_on_disconnect &&
-          dbus_message_is_signal (message,
+      if (dbus_message_is_signal (message,
                                   DBUS_INTERFACE_LOCAL,
                                   "Disconnected"))
         {
-          _dbus_verbose ("Exiting on Disconnected signal\n");
-          CONNECTION_UNLOCK (connection);
-          _dbus_exit (1);
-          _dbus_assert_not_reached ("Call to exit() returned");
+          int i;
+
+          
+          _dbus_bus_check_connection_and_unref (connection);
+          if (connection->exit_on_disconnect)
+            {
+              _dbus_verbose ("Exiting on Disconnected signal\n");
+              CONNECTION_UNLOCK (connection);
+              _dbus_exit (1);
+              _dbus_assert_not_reached ("Call to exit() returned");
+            }
         }
       
       _dbus_list_free_link (message_link);

Index: dbus-connection.h
===================================================================
RCS file: /cvs/dbus/dbus/dbus/dbus-connection.h,v
retrieving revision 1.40
retrieving revision 1.41
diff -u -d -r1.40 -r1.41
--- dbus-connection.h	30 Nov 2005 20:30:02 -0000	1.40
+++ dbus-connection.h	7 Jul 2006 19:42:56 -0000	1.41
@@ -93,7 +93,6 @@
                                                                  DBusError                  *error);
 DBusConnection*    dbus_connection_ref                          (DBusConnection             *connection);
 void               dbus_connection_unref                        (DBusConnection             *connection);
-void               dbus_connection_close                        (DBusConnection             *connection);
 void               dbus_connection_disconnect                   (DBusConnection             *connection);
 dbus_bool_t        dbus_connection_get_is_connected             (DBusConnection             *connection);
 dbus_bool_t        dbus_connection_get_is_authenticated         (DBusConnection             *connection);



More information about the dbus-commit mailing list