[Pkg-utopia-commits] r1119 - in packages/unstable/dbus-glib/debian:
. patches
Sjoerd Simons
sjoerd at alioth.debian.org
Fri Nov 3 11:15:25 CET 2006
Author: sjoerd
Date: 2006-11-03 11:15:24 +0100 (Fri, 03 Nov 2006)
New Revision: 1119
Added:
packages/unstable/dbus-glib/debian/patches/00_unref_crash.patch
Modified:
packages/unstable/dbus-glib/debian/changelog
Log:
* debian/patches/00_unref_crash.patch
+ Added. Fixes a crash if disposing one DBusGProxy causes another for the
same service to be unrefed in a destoyed callback. (From upstream git)
Modified: packages/unstable/dbus-glib/debian/changelog
===================================================================
--- packages/unstable/dbus-glib/debian/changelog 2006-11-02 23:10:55 UTC (rev 1118)
+++ packages/unstable/dbus-glib/debian/changelog 2006-11-03 10:15:24 UTC (rev 1119)
@@ -1,3 +1,11 @@
+dbus-glib (0.71-3) unstable; urgency=low
+
+ * debian/patches/00_unref_crash.patch
+ + Added. Fixes a crash if disposing one DBusGProxy causes another for the
+ same service to be unrefed in a destoyed callback. (From upstream git)
+
+ -- Sjoerd Simons <sjoerd at debian.org> Fri, 3 Nov 2006 11:14:42 +0100
+
dbus-glib (0.71-2) unstable; urgency=low
[ Sebastian Dröge ]
Added: packages/unstable/dbus-glib/debian/patches/00_unref_crash.patch
===================================================================
--- packages/unstable/dbus-glib/debian/patches/00_unref_crash.patch 2006-11-02 23:10:55 UTC (rev 1118)
+++ packages/unstable/dbus-glib/debian/patches/00_unref_crash.patch 2006-11-03 10:15:24 UTC (rev 1119)
@@ -0,0 +1,137 @@
+commit 9bfec032a72e7af5945336fecbb9b6e0b6f2de9e
+Author: Rob Taylor <rob.taylor at collabora.co.uk>
+Date: Wed Oct 25 18:24:53 2006 +0100
+
+ Fixes crash if disposing one DBusGProxy causes another for the same service
+ to be unrefed in a destoyed callback.
+
+diff --git a/dbus/dbus-gproxy.c b/dbus/dbus-gproxy.c
+index bd8ab20..84b2196 100644
+--- a/dbus/dbus-gproxy.c
++++ b/dbus/dbus-gproxy.c
+@@ -664,6 +664,10 @@ unassociate_proxies (gpointer key, gpoin
+ else
+ {
+ data->destroyed = g_slist_prepend (data->destroyed, proxy);
++ /* make contents of list into weak pointers in case the objects
++ * unref each other when disposing */
++ g_object_add_weak_pointer (G_OBJECT (proxy),
++ &(data->destroyed->data));
+ }
+ }
+ }
+@@ -740,8 +744,16 @@ dbus_g_proxy_manager_replace_name_owner
+
+ UNLOCK_MANAGER (manager);
+
++ /* the destroyed list's data pointers are weak pointers, so that we
++ * don't end up calling destroy on proxies which have already been
++ * freed up as a result of other ones being destroyed */
+ for (tmp = data.destroyed; tmp; tmp = tmp->next)
+- dbus_g_proxy_destroy (tmp->data);
++ if (tmp->data != NULL)
++ {
++ g_object_remove_weak_pointer (G_OBJECT (tmp->data),
++ &(tmp->data));
++ dbus_g_proxy_destroy (tmp->data);
++ }
+ g_slist_free (data.destroyed);
+
+ LOCK_MANAGER (manager);
+diff --git a/test/core/test-dbus-glib.c b/test/core/test-dbus-glib.c
+index d8d7c8b..f32b2d4 100644
+--- a/test/core/test-dbus-glib.c
++++ b/test/core/test-dbus-glib.c
+@@ -23,6 +23,9 @@ static gboolean proxy_destroyed = FALSE;
+ static gboolean proxy_destroy_and_nameowner = FALSE;
+ static gboolean proxy_destroy_and_nameowner_complete = FALSE;
+
++static DBusGProxy *test_terminate_proxy1 = NULL;
++static DBusGProxy *test_terminate_proxy2 = NULL;
++
+ static void lose (const char *fmt, ...) G_GNUC_NORETURN G_GNUC_PRINTF (1, 2);
+ static void lose_gerror (const char *prefix, GError *error) G_GNUC_NORETURN;
+
+@@ -50,10 +53,25 @@ proxy_destroyed_cb (DBusGProxy *proxy, g
+ g_source_remove (exit_timeout);
+ g_main_loop_quit (loop);
+ proxy_destroy_and_nameowner_complete = TRUE;
+- }
++ }
+ }
+
+ static void
++test_terminate_proxy1_destroyed_cb (DBusGProxy *proxy, gpointer user_data)
++{
++ proxy_destroyed = TRUE;
++ if (proxy_destroy_and_nameowner && !proxy_destroy_and_nameowner_complete && await_terminating_service == NULL)
++ {
++ g_object_unref(test_terminate_proxy2);
++ test_terminate_proxy2 = NULL;
++ g_source_remove (exit_timeout);
++ g_main_loop_quit (loop);
++ proxy_destroy_and_nameowner_complete = TRUE;
++ }
++}
++
++
++static void
+ name_owner_changed (DBusGProxy *proxy,
+ const char *name,
+ const char *prev_owner,
+@@ -1606,9 +1624,54 @@ main (int argc, char **argv)
+ }
+ g_free (v_STRING_2);
+
++
++ test_terminate_proxy1 = dbus_g_proxy_new_for_name_owner (connection,
++ "org.freedesktop.DBus.GLib.TestService",
++ "/org/freedesktop/DBus/GLib/Tests/MyTestObject",
++ "org.freedesktop.DBus.GLib.Tests.MyObject",
++ &error);
++
++ if (test_terminate_proxy1 == NULL)
++ lose_gerror ("Failed to create proxy for name owner", error);
++
++ test_terminate_proxy2 = dbus_g_proxy_new_for_name_owner (connection,
++ "org.freedesktop.DBus.GLib.TestService",
++ "/org/freedesktop/DBus/GLib/Tests/MyTestObject",
++ "org.freedesktop.DBus.GLib.Tests.MyObject",
++ &error);
++
++ if (test_terminate_proxy2 == NULL)
++ lose_gerror ("Failed to create proxy for name owner", error);
++
++ g_print ("Testing duplicate proxy destruction\n");
++ await_terminating_service = "org.freedesktop.DBus.GLib.TestService";
++ dbus_g_proxy_call_no_reply (test_terminate_proxy1, "Terminate", G_TYPE_INVALID);
++
++ proxy_destroyed = FALSE;
++ proxy_destroy_and_nameowner = TRUE;
++ proxy_destroy_and_nameowner_complete = FALSE;
++
++ g_signal_connect (G_OBJECT (test_terminate_proxy1),
++ "destroy",
++ G_CALLBACK (test_terminate_proxy1_destroyed_cb),
++ NULL);
++
++ dbus_g_connection_flush (connection);
++ exit_timeout = g_timeout_add (5000, timed_exit, loop);
++ g_main_loop_run (loop);
++
++ if (await_terminating_service != NULL)
++ lose ("Didn't see name loss for \"org.freedesktop.DBus.GLib.TestService\"");
++ if (!proxy_destroyed)
++ lose ("Didn't get proxy_destroyed");
++ if (test_terminate_proxy2)
++ lose ("Duplicate proxy wasn'tdestroyed");
++
++ g_print ("Proxy and duplicate destroyed successfully\n");
++
+ g_object_unref (G_OBJECT (driver));
+
+ g_print ("Successfully completed %s\n", argv[0]);
+-
++
+ return 0;
+ }
More information about the Pkg-utopia-commits
mailing list