summaryrefslogtreecommitdiffstats
path: root/mono/Connection.cs
diff options
context:
space:
mode:
authorJoe Shaw <joeshaw@novell.com>2005-03-08 20:45:03 +0000
committerJoe Shaw <joeshaw@novell.com>2005-03-08 20:45:03 +0000
commitd96c9e465abb291cb943a1b4ec3643de4b3f6423 (patch)
treee39796b0e824648366a8f2ea606e3a4cef53a434 /mono/Connection.cs
parent2ebf5709efd40f6a15f2433d5f23a1b615f6cc5d (diff)
2005-03-08 Joe Shaw <joeshaw@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.
Diffstat (limited to 'mono/Connection.cs')
-rw-r--r--mono/Connection.cs19
1 files changed, 19 insertions, 0 deletions
diff --git a/mono/Connection.cs b/mono/Connection.cs
index 699fee9e..6abd7e80 100644
--- a/mono/Connection.cs
+++ b/mono/Connection.cs
@@ -171,6 +171,13 @@ namespace DBus
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 @@ namespace DBus
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 ();
}
}
}