[maemo-commits] [maemo-commits] r14640 - in projects/haf/trunk/dbus/debian: . patches
From: subversion at stage.maemo.org subversion at stage.maemo.orgDate: Fri Oct 26 16:23:26 EEST 2007
- Previous message: [maemo-commits] r14639 - in projects/haf/trunk/hildon-theme-layout-4: . rc
- Next message: [maemo-commits] r14641 - in projects/haf/trunk/python-hildondesktop: . debian libhildondesktop
- Messages sorted by: [ date ] [ thread ] [ subject ] [ author ]
Author: kihamala Date: 2007-10-26 16:23:24 +0300 (Fri, 26 Oct 2007) New Revision: 14640 Added: projects/haf/trunk/dbus/debian/patches/35-unref-no-guid-connections.patch Modified: projects/haf/trunk/dbus/debian/changelog Log: unref guidless connections, first try Modified: projects/haf/trunk/dbus/debian/changelog =================================================================== --- projects/haf/trunk/dbus/debian/changelog 2007-10-26 12:56:38 UTC (rev 14639) +++ projects/haf/trunk/dbus/debian/changelog 2007-10-26 13:23:24 UTC (rev 14640) @@ -3,6 +3,7 @@ * Added dbus-dbg package. Fixes: NB#70750 * Fixed a possible segfault in dbus_connection_send_with_reply when the connection has been disconnected. + * Also unreference connections without guid. Bugs discovered by statical code analysis: * Added a missing va_end call to dbus_set_error. Added: projects/haf/trunk/dbus/debian/patches/35-unref-no-guid-connections.patch =================================================================== --- projects/haf/trunk/dbus/debian/patches/35-unref-no-guid-connections.patch 2007-10-26 12:56:38 UTC (rev 14639) +++ projects/haf/trunk/dbus/debian/patches/35-unref-no-guid-connections.patch 2007-10-26 13:23:24 UTC (rev 14640) @@ -0,0 +1,100 @@ +diff -pur dbus-1.0.2/dbus/dbus-connection.c dbus-1.0.2.new/dbus/dbus-connection.c +--- dbus-1.0.2/dbus/dbus-connection.c 2006-12-11 21:21:08.000000000 +0200 ++++ dbus-1.0.2.new/dbus/dbus-connection.c 2007-10-26 16:21:04.047254488 +0300 +@@ -1434,6 +1434,27 @@ _dbus_connection_handle_watch (DBusWatch + + _DBUS_DEFINE_GLOBAL_LOCK (shared_connections); + static DBusHashTable *shared_connections = NULL; ++static DBusList *no_guid_connections = NULL; ++ ++static void ++connection_shutdown_helper (DBusConnection *connection) ++{ ++ DBusMessage *message; ++ ++ _DBUS_UNLOCK (shared_connections); ++ ++ dbus_connection_ref (connection); ++ _dbus_connection_close_possibly_shared (connection); ++ ++ /* Churn through to the Disconnected message */ ++ while ((message = dbus_connection_pop_message (connection))) ++ { ++ dbus_message_unref (message); ++ } ++ dbus_connection_unref (connection); ++ ++ _DBUS_LOCK (shared_connections); ++} + + static void + shared_connections_shutdown (void *data) +@@ -1446,7 +1467,6 @@ shared_connections_shutdown (void *data) + while ((n_entries = _dbus_hash_table_get_n_entries (shared_connections)) > 0) + { + DBusConnection *connection; +- DBusMessage *message; + DBusHashIter iter; + + _dbus_hash_iter_init (shared_connections, &iter); +@@ -1454,19 +1474,7 @@ shared_connections_shutdown (void *data) + + connection = _dbus_hash_iter_get_value (&iter); + +- _DBUS_UNLOCK (shared_connections); +- +- dbus_connection_ref (connection); +- _dbus_connection_close_possibly_shared (connection); +- +- /* Churn through to the Disconnected message */ +- while ((message = dbus_connection_pop_message (connection))) +- { +- dbus_message_unref (message); +- } +- dbus_connection_unref (connection); +- +- _DBUS_LOCK (shared_connections); ++ connection_shutdown_helper (connection); + + /* The connection should now be dead and not in our hash ... */ + _dbus_assert (_dbus_hash_table_get_n_entries (shared_connections) < n_entries); +@@ -1476,6 +1484,19 @@ shared_connections_shutdown (void *data) + + _dbus_hash_table_unref (shared_connections); + shared_connections = NULL; ++ ++ if (no_guid_connections != NULL) ++ { ++ DBusConnection *connection; ++ connection = _dbus_list_pop_first (&no_guid_connections); ++ while (connection != NULL) ++ { ++ connection_shutdown_helper (connection); ++ connection = _dbus_list_pop_first (&no_guid_connections); ++ } ++ } ++ ++ no_guid_connections = NULL; + + _DBUS_UNLOCK (shared_connections); + } +@@ -1585,7 +1606,18 @@ connection_record_shared_unlocked (DBusC + _dbus_connection_ref_unlocked (connection); + + if (guid == NULL) +- return TRUE; /* don't store in the hash */ ++ { ++ _DBUS_LOCK (shared_connections); ++ ++ if (!_dbus_list_prepend (&no_guid_connections, connection)) ++ { ++ _DBUS_UNLOCK (shared_connections); ++ return FALSE; ++ } ++ ++ _DBUS_UNLOCK (shared_connections); ++ return TRUE; /* don't store in the hash */ ++ } + + /* A separate copy of the key is required in the hash table, because + * we don't have a lock on the connection when we are doing a hash
- Previous message: [maemo-commits] r14639 - in projects/haf/trunk/hildon-theme-layout-4: . rc
- Next message: [maemo-commits] r14641 - in projects/haf/trunk/python-hildondesktop: . debian libhildondesktop
- Messages sorted by: [ date ] [ thread ] [ subject ] [ author ]