dbus/mono Connection.cs,1.11,1.12

Joe Shaw joe at freedesktop.org
Tue Mar 8 12:45:05 PST 2005


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

Modified Files:
	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.
 
        * 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/Array.cs: "Code" is a static member, so
	don't use "this" to refer to it.  Fix for stricter checking
	in Mono 1.1.4.
 
        * mono/DBusType/ObjectPath.cs (Append): Don't leak the
	object path that we pass into unmanaged code.
 
        * mono/DBusType/String.cs (Append): Don't leak the string
	that we pass into unmanged code.

Index: Connection.cs
===================================================================
RCS file: /cvs/dbus/dbus/mono/Connection.cs,v
retrieving revision 1.11
retrieving revision 1.12
diff -u -d -r1.11 -r1.12
--- Connection.cs	12 Feb 2005 00:51:33 -0000	1.11
+++ Connection.cs	8 Mar 2005 20:45:03 -0000	1.12
@@ -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