* dbus/dbus-connection.c (dbus_connection_close): removed deprecated
authorJohn (J5) Palmieri <johnp@redhat.com>
Fri, 7 Jul 2006 19:42:56 +0000 (19:42 +0000)
committerJohn (J5) Palmieri <johnp@redhat.com>
Fri, 7 Jul 2006 19:42:56 +0000 (19:42 +0000)
  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

ChangeLog
dbus/dbus-bus.c
dbus/dbus-bus.h
dbus/dbus-connection.c
dbus/dbus-connection.h
doc/TODO

index e4773d5..b8062ca 100644 (file)
--- a/ChangeLog
+++ b/ChangeLog
@@ -1,3 +1,17 @@
+2006-07-07  John (J5) Palmieri  <johnp@redhat.com>
+
+       * 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
 2006-06-14  Ross Burton  <ross@openedhand.com>
 
        * glib/dbus-gobject.c:
index 0b8c9c4..273fe5f 100644 (file)
@@ -302,6 +302,23 @@ ensure_bus_data (DBusConnection *connection)
   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 @@ internal_bus_get (DBusBusType  type,
     }
 
   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 2329e13..c47af15 100644 (file)
@@ -68,6 +68,8 @@ void            dbus_bus_remove_match     (DBusConnection *connection,
                                            const char     *rule,
                                            DBusError      *error);
 
+void           _dbus_bus_check_connection_and_unref (DBusConnection *connection);
+
 DBUS_END_DECLS
 
 #endif /* DBUS_BUS_H */
index 4a2d087..9f6e626 100644 (file)
@@ -1947,18 +1947,6 @@ dbus_connection_close (DBusConnection *connection)
   _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_connection_dispatch (DBusConnection *connection)
     {
       _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 9784f26..983f327 100644 (file)
@@ -93,7 +93,6 @@ DBusConnection*    dbus_connection_open_private                 (const char
                                                                  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);
index 1b75985..6ae67d1 100644 (file)
--- a/doc/TODO
+++ b/doc/TODO
@@ -1,3 +1,15 @@
+Important for 0.90 freeze
+===
+
+- Audit @todo and FIXME for security issues that require API/ABI changes
+
+- dbus-pending-call.c has some API and thread safety issues to review.
+   DBusPendingCall is used from multiple threads with no locks.
+   Either DBusConnection's lock has to protect all associated pending
+   call (means pending->connection can't ever be set to null) or
+   or DBusPendingCall needs its own lock
+   http://lists.freedesktop.org/archives/dbus/2006-June/004945.html
+
 Important for 1.0
 ===
 
@@ -8,8 +20,6 @@ Important for 1.0
    locks. Fixes the recursive deadlock. See the @todo for more
    and this thread: http://lists.freedesktop.org/archives/dbus/2006-February/004128.html
 
- - Remove all deprecated functions
-
  - Audit @todo and FIXME for security issues
 
  - the "break loader" and valid/invalid message tests are all disabled;
@@ -21,30 +31,8 @@ Important for 1.0
 
  - just before 1.0, try a HAVE_INT64=0 build and be sure it runs
 
- - dbus-pending-call.c has some API and thread safety issues to review.
-   DBusPendingCall is used from multiple threads with no locks.
-   Either DBusConnection's lock has to protect all associated pending
-   call (means pending->connection can't ever be set to null) or 
-   or DBusPendingCall needs its own lock
-   http://lists.freedesktop.org/archives/dbus/2006-June/004945.html
-
- - Add test harness for selinux allow/deny cf. this message
-   http://lists.freedesktop.org/archives/dbus/2005-April/002506.html
-
  - publish the introspection dtd at its URL
  
- - RequestName flags seem a bit strange; see the docs for dbus_bus_request_name() 
-   and think about use cases in better detail. 
-   Proposal on list:
-   http://lists.freedesktop.org/archives/dbus/2005-August/003207.html
-
-   Kind of a major API change, but seems high-value.
-
- - dbus_bus_get() should hold a strong reference associated with the "connected" 
-   state (i.e. libdbus drops its reference when the connection disconnects,
-   and sets its internal connection variable to null).
-   See http://lists.freedesktop.org/archives/dbus/2006-May/004806.html
-
 Important for 1.0 GLib Bindings
 ===