[Patch] Protecting DBusGProxy from multiple disposes

Iain Holmes iain at openedhand.com
Fri Jan 27 03:54:27 PST 2006


Attached is a patch that protects DBusGProxy from being disposed 
multiple times. Without it I was seeing lots of error messages and 
occasional memory corruption crashes.

Iain
-------------- next part --------------
Index: ChangeLog
===================================================================
RCS file: /cvs/dbus/dbus/ChangeLog,v
retrieving revision 1.948
diff -U2 -r1.948 ChangeLog
--- ChangeLog	19 Jan 2006 02:54:07 -0000	1.948
+++ ChangeLog	27 Jan 2006 11:59:59 -0000
@@ -1,2 +1,7 @@
+2006-01-27  Iain Holmes  <iain at openedhand.com>
+
+	* glib/dbus-gproxy.c (dbus_g_proxy_dispose): Protect the dispose
+	method from being called multiple times.
+
 2006-01-19  Robert McQueen  <robot101 at debian.org>
 
Index: glib/dbus-gproxy.c
===================================================================
RCS file: /cvs/dbus/dbus/glib/dbus-gproxy.c,v
retrieving revision 1.44
diff -U2 -r1.44 dbus-gproxy.c
--- glib/dbus-gproxy.c	5 Jan 2006 20:22:06 -0000	1.44
+++ glib/dbus-gproxy.c	27 Jan 2006 12:00:00 -0000
@@ -1396,8 +1396,13 @@
   DBusGProxyPrivate *priv = DBUS_G_PROXY_GET_PRIVATE(proxy);
 
+  if (priv->pending_calls == NULL) 
+    {
+      return;
+    }
 
   /* Cancel outgoing pending calls */
   g_hash_table_foreach (priv->pending_calls, cancel_pending_call, proxy);
   g_hash_table_destroy (priv->pending_calls);
+  priv->pending_calls = NULL;
 
   if (priv->manager && proxy != priv->manager->bus_proxy)


More information about the dbus mailing list