raster pushed a commit to branch master.

http://git.enlightenment.org/legacy/e_dbus.git/commit/?id=50964a9e87504dd5461ddbeb1c0df14378b1867d

commit 50964a9e87504dd5461ddbeb1c0df14378b1867d
Author: Tae-Hwan Kim <[email protected]>
Date:   Tue Feb 11 17:56:25 2014 +0900

    Force to free e dbus connection
    
    Summary:
    Do not use free function of dbus library. Sometimes free function will not 
be called.
    I don't know the reason exactly but edbus perform it asynchronously. so it 
can be called after edbus shutdown already. That can cause some problem.
    
    Reviewers: raster, cedric, Hermet, seoz, barbieri, lfelipe
    
    Differential Revision: https://phab.enlightenment.org/D481
---
 src/lib/dbus/e_dbus.c | 19 ++++++++++++++++---
 1 file changed, 16 insertions(+), 3 deletions(-)

diff --git a/src/lib/dbus/e_dbus.c b/src/lib/dbus/e_dbus.c
index 8ab84dc..e55a090 100644
--- a/src/lib/dbus/e_dbus.c
+++ b/src/lib/dbus/e_dbus.c
@@ -186,9 +186,8 @@ e_dbus_connection_new(DBusConnection *conn)
 }
 
 static void
-e_dbus_connection_free(void *data)
+e_dbus_connection_free(E_DBus_Connection *cd)
 {
-  E_DBus_Connection *cd = data;
   Ecore_Fd_Handler *fd_handler;
   Ecore_Timer *timer;
   DBG("e_dbus_connection free!");
@@ -488,7 +487,7 @@ e_dbus_connection_setup(DBusConnection *conn)
   dbus_connection_set_exit_on_disconnect(cd->conn, EINA_FALSE);
   dbus_connection_allocate_data_slot(&connection_slot);
 
-  dbus_connection_set_data(cd->conn, connection_slot, (void *)cd, 
e_dbus_connection_free);
+  dbus_connection_set_data(cd->conn, connection_slot, (void *)cd, NULL);
   dbus_connection_set_watch_functions(cd->conn,
                                       cb_watch_add,
                                       cb_watch_del,
@@ -550,6 +549,7 @@ e_dbus_connection_close(E_DBus_Connection *conn)
 
   dbus_connection_close(conn->conn);
   dbus_connection_unref(conn->conn);
+  e_dbus_connection_free(conn);
 
   // Note: the E_DBus_Connection gets freed when the dbus_connection is 
cleaned up by the previous unref
 }
@@ -614,6 +614,19 @@ e_dbus_shutdown(void)
    if (--_edbus_init_count)
     return _edbus_init_count;
 
+   // FIXME: this is workaround
+   while  (shared_connections[DBUS_BUS_SESSION] &&
+           shared_connections[DBUS_BUS_SESSION]->refcount >= 1)
+     {
+        e_dbus_connection_close(shared_connections[DBUS_BUS_SESSION]);
+     }
+   // FIXME: this is workaround
+   while (shared_connections[DBUS_BUS_SYSTEM] &&
+          shared_connections[DBUS_BUS_SYSTEM]->refcount >= 1)
+     {
+        e_dbus_connection_close(shared_connections[DBUS_BUS_SYSTEM]);
+     }
+
   e_dbus_object_shutdown();
   ecore_shutdown();
   eina_log_domain_unregister(_e_dbus_log_dom);

-- 


Reply via email to