summaryrefslogtreecommitdiff
path: root/src
diff options
context:
space:
mode:
authorUlisses Furquim <ulisses@profusion.mobi>2013-01-03 14:06:20 +0000
committerLucas De Marchi <lucas.demarchi@profusion.mobi>2013-01-03 14:06:20 +0000
commitaf8c81634fe96b599c0c30d4677630fe24f6a26d (patch)
tree6f25a305a7dc5deb209ebbf5cfbe75abed6fb305 /src
parent32d7c8d5a9ff8db6b692b5d441fc4f520e825ef4 (diff)
edbus: Fix connection name leak
Hack to fix the connection name leak. The problem is that each signal handler has a reference to the FDO_BUS connection name and when the penultimate connection name is released (and therefore its signal handler), FDO_BUS is released, too. Check if cn is still in the hash before trying to free it. Patch by: Ulisses Furquim <ulisses@profusion.mobi> SVN revision: 82077
Diffstat (limited to 'src')
-rw-r--r--src/lib/edbus/edbus_core.c16
1 files changed, 9 insertions, 7 deletions
diff --git a/src/lib/edbus/edbus_core.c b/src/lib/edbus/edbus_core.c
index 9c0e083012..f060ee8bcd 100644
--- a/src/lib/edbus/edbus_core.c
+++ b/src/lib/edbus/edbus_core.c
@@ -381,10 +381,7 @@ edbus_connection_name_gc(EDBus_Connection *conn, EDBus_Connection_Name *cn)
381 381
382 eina_hash_del(conn->names, cn->name, cn); 382 eina_hash_del(conn->names, cn->name, cn);
383 if (cn->name_owner_changed) 383 if (cn->name_owner_changed)
384 { 384 edbus_signal_handler_del(cn->name_owner_changed);
385 cn->name_owner_changed->bus = NULL;
386 edbus_signal_handler_del(cn->name_owner_changed);
387 }
388 if (cn->objects) 385 if (cn->objects)
389 eina_hash_free(cn->objects); 386 eina_hash_free(cn->objects);
390 eina_stringshare_del(cn->name); 387 eina_stringshare_del(cn->name);
@@ -1004,6 +1001,7 @@ _edbus_connection_unref(EDBus_Connection *conn)
1004 Eina_Iterator *iter; 1001 Eina_Iterator *iter;
1005 EDBus_Connection_Name *cn; 1002 EDBus_Connection_Name *cn;
1006 Eina_Array *cns; 1003 Eina_Array *cns;
1004 const char *name;
1007 1005
1008 DBG("Connection %p: unref (currently at %d refs)", 1006 DBG("Connection %p: unref (currently at %d refs)",
1009 conn, conn->refcount); 1007 conn, conn->refcount);
@@ -1034,12 +1032,16 @@ _edbus_connection_unref(EDBus_Connection *conn)
1034 cn->event_handlers.list); 1032 cn->event_handlers.list);
1035 free(ctx); 1033 free(ctx);
1036 } 1034 }
1037 eina_array_push(cns, cn); 1035 eina_array_push(cns, eina_stringshare_add(cn->name));
1038 } 1036 }
1039 eina_iterator_free(iter); 1037 eina_iterator_free(iter);
1040 1038
1041 while ((cn = eina_array_pop(cns))) 1039 while ((name = eina_array_pop(cns)))
1042 edbus_connection_name_gc(conn, cn); 1040 {
1041 cn = eina_hash_find(conn->names, name);
1042 if (cn) edbus_connection_name_gc(conn, cn);
1043 eina_stringshare_del(name);
1044 }
1043 1045
1044 eina_hash_free(conn->names); 1046 eina_hash_free(conn->names);
1045 eina_array_free(cns); 1047 eina_array_free(cns);