summaryrefslogtreecommitdiff
path: root/legacy/edbus/src/lib/edbus_core.c
diff options
context:
space:
mode:
authorLucas De Marchi <lucas.demarchi@profusion.mobi>2012-12-20 14:52:27 +0000
committerLucas De Marchi <lucas.demarchi@profusion.mobi>2012-12-20 14:52:27 +0000
commit80bdcca7edbe39a693d6399abaac4293ca576414 (patch)
tree88f5684052713a808c93fd0aecfb20c162a56b46 /legacy/edbus/src/lib/edbus_core.c
parent83619110f22f83c50384d78ca7d1381481a3eb25 (diff)
edbus: avoid cyclic unref
If we are freeing a EDBUS_Connection_Name its name_owner_changed signal handler may hold a pointer and try to unref it when deleting the signal handler. We can't simply make the signal handler hold a reference to the connection name, otherwise edbus_connection_name_gc will never be triggered because of cyclic references. Thus, just set the cn->name_owner_changed->bus to NULL before trying to delete the signal handler. Related log found by Lucas Jóia: ==20607== Invalid read of size 4 ==20607== at 0x6FE29EE: edbus_connection_name_gc.isra.3 (edbus_core.c:375) ==20607== by 0x6FE4287: edbus_connection_unref (edbus_core.c:1028) ==20607== by 0x4C8D94: e_msgbus_shutdown (e_msgbus.c:167) ==20607== by 0x436194: _e_main_shutdown (e_main.c:1136) ==20607== by 0x434F25: main (e_main.c:1074) ==20607== Address 0x1461ba68 is 24 bytes inside a block of size 64 free'd ==20607== at 0x4C2A739: free (in /usr/lib/valgrind/vgpreload_memcheck-amd64-linux.so) ==20607== by 0x6FF0E78: edbus_signal_handler_unref (edbus_signal_handler.c:269) ==20607== by 0x6FE2A48: edbus_connection_name_gc.isra.3 (edbus_core.c:384) ==20607== by 0x6FE4287: edbus_connection_unref (edbus_core.c:1028) ==20607== by 0x4C8D94: e_msgbus_shutdown (e_msgbus.c:167) ==20607== by 0x436194: _e_main_shutdown (e_main.c:1136) ==20607== by 0x434F25: main (e_main.c:1074) SVN revision: 81463
Diffstat (limited to '')
-rw-r--r--legacy/edbus/src/lib/edbus_core.c5
1 files changed, 4 insertions, 1 deletions
diff --git a/legacy/edbus/src/lib/edbus_core.c b/legacy/edbus/src/lib/edbus_core.c
index 0fdaf733a8..f28a38a724 100644
--- a/legacy/edbus/src/lib/edbus_core.c
+++ b/legacy/edbus/src/lib/edbus_core.c
@@ -381,7 +381,10 @@ 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 edbus_signal_handler_del(cn->name_owner_changed); 384 {
385 cn->name_owner_changed->bus = NULL;
386 edbus_signal_handler_del(cn->name_owner_changed);
387 }
385 if (cn->objects) 388 if (cn->objects)
386 eina_hash_free(cn->objects); 389 eina_hash_free(cn->objects);
387 eina_stringshare_del(cn->name); 390 eina_stringshare_del(cn->name);