dbus/mono Connection.cs,1.9.2.1,1.9.2.2

Joe Shaw joe at freedesktop.org
Tue Mar 8 12:42:23 PST 2005


Update of /cvs/dbus/dbus/mono
In directory gabe:/tmp/cvs-serv30080/mono

Modified Files:
      Tag: dbus-0-23
	Connection.cs 
Log Message:
2005-03-08  Joe Shaw  <joeshaw at novell.com>

	* dbus/dbus-connection.c (dbus_connection_send_with_reply):
	After we attach our pending call to the connection, unref
	it.  Fixes a leak.

	* dbus/dbus-pending-call.c (dbus_pending_call_get_reply):
	Add this back.  Accidentally broke API/ABI compat.

	* mono/Connection.cs (set_RawConnection): Disconnect our
	filter and match callbacks from the old connection and
	reconnect them to the new connection, if any.

	* mono/DBusType/ObjectPath.cs (ctor): Don't leak the
	object path that we get back from unmanaged code.
	(Append): Don't leak the object path that we pass
	into unmanaged code.

	* mono/DBusType/String.cs (ctor): Don't leak the string
	that we get back from unmanaged code.
	(Append): Don't leak the string that we pass into
	unmanaged code.

Index: Connection.cs
===================================================================
RCS file: /cvs/dbus/dbus/mono/Connection.cs,v
retrieving revision 1.9.2.1
retrieving revision 1.9.2.2
diff -u -d -r1.9.2.1 -r1.9.2.2
--- Connection.cs	12 Feb 2005 00:33:25 -0000	1.9.2.1
+++ Connection.cs	8 Mar 2005 20:42:21 -0000	1.9.2.2
@@ -171,6 +171,13 @@
 	  
 	  if (rawConnection != IntPtr.Zero) 
 	    {
+              // Remove our callbacks from this connection
+              foreach (DBusHandleMessageFunction func in this.filters)
+                dbus_connection_remove_filter (rawConnection, func, IntPtr.Zero);
+
+              foreach (string match_rule in this.matches)
+                dbus_bus_remove_match (rawConnection, match_rule, IntPtr.Zero);
+
 	      // Get the reference to this
 	      IntPtr rawThis = dbus_connection_get_data (rawConnection, Slot);
 	      Debug.Assert (rawThis != IntPtr.Zero);
@@ -197,6 +204,18 @@
 	      rawThis = GCHandle.Alloc (this, GCHandleType.WeakTrackResurrection);
 	      
 	      dbus_connection_set_data(rawConnection, Slot, (IntPtr) rawThis, IntPtr.Zero);
+
+              // Add the callbacks to this new connection
+              foreach (DBusHandleMessageFunction func in this.filters)
+                dbus_connection_add_filter (rawConnection, func, IntPtr.Zero, IntPtr.Zero);
+
+              foreach (string match_rule in this.matches)
+                dbus_bus_add_match (rawConnection, match_rule, IntPtr.Zero);
+	    }
+	  else
+	    {
+	      this.filters.Clear ();
+              this.matches.Clear ();
 	    }
 	}
     }



More information about the dbus-commit mailing list