]> git.ipfire.org Git - thirdparty/dbus.git/commitdiff
2005-03-08 Joe Shaw <joeshaw@novell.com>
authorJoe Shaw <joeshaw@novell.com>
Tue, 8 Mar 2005 20:45:03 +0000 (20:45 +0000)
committerJoe Shaw <joeshaw@novell.com>
Tue, 8 Mar 2005 20:45:03 +0000 (20:45 +0000)
        * 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.

ChangeLog
dbus/dbus-connection.c
mono/Connection.cs
mono/DBusType/Array.cs
mono/DBusType/ObjectPath.cs
mono/DBusType/String.cs

index fa567f729c2fd558ff06438f35bec91ddd85d00b..91153314c6c65dd70008d74d313a9524cb4a3f54 100644 (file)
--- a/ChangeLog
+++ b/ChangeLog
@@ -1,3 +1,23 @@
+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.
+
 2005-03-07  John (J5) Palmieri  <johnp@redhat.com>
        * NEWS: Update for 0.31
 
index 92e0331bf74d72388094ae5c85c5df7c995a97b2..db76ba22394e6c1874cffd1cba23f8f7701698e6 100644 (file)
@@ -2459,7 +2459,9 @@ dbus_connection_send_with_reply (DBusConnection     *connection,
   if (!_dbus_connection_attach_pending_call_unlocked (connection,
                                                      pending))
     goto error;
-  
+  dbus_pending_call_unref (pending);
   if (!_dbus_connection_send_unlocked_no_update (connection, message, NULL))
     {
       _dbus_connection_detach_pending_call_and_unlock (connection,
index 699fee9e3bd5760fe5f322562e384af622fe0abe..6abd7e80a748554f0ee32e7a22284b38cd29d58a 100644 (file)
@@ -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 ();
            }
        }
     }
index 7e46f73df1686d1ba52a49577149573ae7d9268f..ef001b98a33278f2f2d3babd453cf64eb8f05d43 100644 (file)
@@ -59,7 +59,7 @@ namespace DBus.DBusType
       IntPtr arrayIter = Marshal.AllocCoTaskMem (Arguments.DBusMessageIterSize);
 
       if (!dbus_message_iter_open_container (iter,
-                                            (int) this.Code,
+                                            (int) Code,
                                             Arguments.GetCodeAsString (elementType),
                                             arrayIter)) {
        throw new ApplicationException("Failed to append array argument: " + val);
index 01a21ca9b3fb9aafebb4d2b8c51259df6682f0b6..4f064d591ddebb6874d9b99b833bd2514afe86ef 100644 (file)
@@ -52,7 +52,10 @@ namespace DBus.DBusType
     {
       IntPtr marshalVal = Marshal.StringToHGlobalAnsi (Path);
 
-      if (!dbus_message_iter_append_basic (iter, (int) Code, ref marshalVal))
+      bool success = dbus_message_iter_append_basic (iter, (int) Code, ref marshalVal);
+      Marshal.FreeHGlobal (marshalVal);
+
+      if (!success)
        throw new ApplicationException("Failed to append OBJECT_PATH argument:" + val);
     }
 
index bf354ea07aff57684df1fb8e29d72077fcf1d0f3..3b619cfbd0868e17c7fa72c01d0f97c9198b5d67 100644 (file)
@@ -36,7 +36,10 @@ namespace DBus.DBusType
     {
       IntPtr marshalVal = Marshal.StringToHGlobalAnsi (val);
 
-      if (!dbus_message_iter_append_basic (iter, (int) Code, ref marshalVal))
+      bool success = dbus_message_iter_append_basic (iter, (int) Code, ref marshalVal);
+      Marshal.FreeHGlobal (marshalVal);
+
+      if (!success)
        throw new ApplicationException("Failed to append STRING argument:" + val);
     }