Enlightenment CVS committal

Author  : barbieri
Project : e17
Module  : proto/e_dbus

Dir     : e17/proto/e_dbus/src/lib/dbus


Modified Files:
        e_dbus.c 


Log Message:
Don't leak dbus connection.

We don't need the dbus_connection_ref and _unref because we already
own a reference to the connection after calling dbus_bus_get_private
inside e_dbus_bus_get. Moreover, we're storing a pointer to our
E_DBus_Connection variable in the DBusConnection and setting a
function to free it when the data is replaced or the connection is
finalized (see e_dbus_connection_setup). However, the dbus connection
will never be finalized because we're holding one reference to it
inside our E_DBus_Connection strucuture! This extra reference we're
holding is preventing e_dbus_connection_close from finalizing the dbus
connection (see the Note in the code there). Thus, we're leaking both
the dbus connection and our E_DBus_Connection. Not good, not good at
all. :-/

Patch by Ulisses Furquim, fixing his previous patch.

===================================================================
RCS file: /cvs/e/e17/proto/e_dbus/src/lib/dbus/e_dbus.c,v
retrieving revision 1.8
retrieving revision 1.9
diff -u -3 -r1.8 -r1.9
--- e_dbus.c    26 Sep 2007 14:08:44 -0000      1.8
+++ e_dbus.c    27 Sep 2007 00:44:42 -0000      1.9
@@ -146,7 +146,7 @@
   cd = calloc(1, sizeof(E_DBus_Connection));
   if (!cd) return NULL;
 
-  cd->conn = dbus_connection_ref(conn);
+  cd->conn = conn;
   cd->conn_name = strdup(dbus_bus_get_unique_name(conn));
 
   DEBUG(1, "Connected! Name: %s\n", cd->conn_name);
@@ -180,7 +180,6 @@
     shared_connections[cd->shared_type] = NULL;
 
   if (cd->conn_name) free(cd->conn_name);
-  dbus_connection_unref(cd->conn);
 
   free(cd);
 }



-------------------------------------------------------------------------
This SF.net email is sponsored by: Microsoft
Defy all challenges. Microsoft(R) Visual Studio 2005.
http://clk.atdmt.com/MRT/go/vse0120000070mrt/direct/01/
_______________________________________________
enlightenment-cvs mailing list
[email protected]
https://lists.sourceforge.net/lists/listinfo/enlightenment-cvs

Reply via email to