Commit Graph

26 Commits

Author SHA1 Message Date
Lucas De Marchi 80bdcca7ed 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
2012-12-20 14:52:27 +00:00
Lucas De Marchi 83619110f2 edbus: Do not modify cn->names hash while walking it
Bug triggered by Lucas Jóia:

==10042== Invalid read of size 8
==10042==    at 0x6B86626: _eina_rbtree_iterator_next (eina_rbtree.c:165)
==10042==    by 0x6B7228D: _eina_hash_iterator_next (eina_hash.c:622)
==10042==    by 0x6FE41DC: edbus_connection_unref (edbus_core.c:1015)
==10042==    by 0x4C8D94: e_msgbus_shutdown (e_msgbus.c:167)
==10042==    by 0x436194: _e_main_shutdown (e_main.c:1136)
==10042==    by 0x434F25: main (e_main.c:1074)
==10042==  Address 0x15c1b958 is 40 bytes inside a block of size 96 free'd
==10042==    at 0x4C2A739: free (in /usr/lib/valgrind/vgpreload_memcheck-amd64-linux.so)
==10042==    by 0x6B71CB7: _eina_hash_del_by_hash_el (eina_hash.c:441)
==10042==    by 0x6FE2A1E: edbus_connection_name_gc.isra.2 (edbus_core.c:385)
==10042==    by 0x6FE4217: edbus_connection_unref (edbus_core.c:1026)
==10042==    by 0x4C8D94: e_msgbus_shutdown (e_msgbus.c:167)
==10042==    by 0x436194: _e_main_shutdown (e_main.c:1136)
==10042==    by 0x434F25: main (e_main.c:1074)



SVN revision: 81462
2012-12-20 14:52:21 +00:00
Lucas De Marchi 1cae2f1968 edbus: no need for this auxiliary variables, and check refcount first
SVN revision: 81461
2012-12-20 14:52:15 +00:00
Lucas De Marchi bb50f86bc5 edbus: (de)yodafy free cb functions
edbus_connection_cb_free_add     -> edbus_connection_free_cb_add
edbus_connection_cb_free_del     -> edbus_connection_free_cb_del
edbus_object_cb_free_add         -> edbus_object_free_cb_add
edbus_object_cb_free_del         -> edbus_object_free_cb_del
edbus_pending_cb_free_add        -> edbus_pending_free_cb_add
edbus_pending_cb_free_del        -> edbus_pending_free_cb_del
edbus_proxy_cb_free_add          -> edbus_proxy_free_cb_add
edbus_proxy_cb_free_del          -> edbus_proxy_free_cb_del
edbus_signal_handler_cb_free_add -> edbus_signal_handler_free_cb_add
edbus_signal_handler_cb_free_del -> edbus_signal_handler_free_cb_del



SVN revision: 81389
2012-12-19 17:30:11 +00:00
Lucas De Marchi c4cedac312 edbus: rename DISCONNECTED event
SVN revision: 81177
2012-12-17 18:25:13 +00:00
Lucas De Marchi effae37eab edbus: Fix typo in error message
SVN revision: 81172
2012-12-17 18:24:43 +00:00
Lucas De Marchi eb967fa9d8 edbus: remove unneeded code
SVN revision: 80965
2012-12-14 16:28:50 +00:00
Lucas De Marchi 57e4972180 edbus: if you goto end, you don't use else
SVN revision: 80964
2012-12-14 16:28:46 +00:00
Lucas De Marchi cbc0a8311a edbus: Better naming for FDO proxy in connection
Patch by: Lucas De Marchi <lucas.de.marchi@gmail.com>



SVN revision: 80707
2012-12-11 19:52:02 +00:00
José Roberto de Souza d05347bb91 edbus: Keep only one reference of object and proxy of dbus daemon interface per connection
Patch by: José Roberto de Souza  <zehortigoza@profusion.mobi>



SVN revision: 80706
2012-12-11 19:51:38 +00:00
José Roberto de Souza 80adffbdb0 edbus: Add Disconnected event in connection
Patch by: José Roberto de Souza  <zehortigoza@profusion.mobi>



SVN revision: 80693
2012-12-11 19:50:29 +00:00
José Roberto de Souza 1956b12fa0 edbus: Remove unnecessary connection events
Patch by: José Roberto de Souza  <zehortigoza@profusion.mobi>



SVN revision: 80692
2012-12-11 19:50:25 +00:00
José Roberto de Souza 3c8076fa53 edbus: Add edbus_private_connection_get()
Patch by: José Roberto de Souza  <zehortigoza@profusion.mobi>



SVN revision: 80691
2012-12-11 19:50:20 +00:00
José Roberto de Souza 5a49f65f6f edbus: Allow to monitor unique id in edbus_name_owner_changed_callback_add
This allows to monitor when a client exits. Clients in general don't
register a name in the bus and in some cases it's even not allowed to do
(for example an agent talking to bluetoothd, that runs in system bus).

Patch by: José Roberto de Souza  <zehortigoza@profusion.mobi>



SVN revision: 80687
2012-12-11 19:50:06 +00:00
José Roberto de Souza 00e6dac1ac edbus: Fix bug found in refactored banshee example
Refactor edbus_signal_handler_add() so internal signal handlers don't
set the connection free callback. This fixes the bug in which
EDBus_Connection was freeing the signal handler of EDBus_Conenction_Name

==22814== Invalid read of size 4
==22814==    at 0x40564B0: edbus_signal_handler_del (edbus_signal_handler.c:278)
==22814==    by 0x4040E65: _edbus_connection_name_unref (edbus_core.c:507)
==22814==    by 0x404106B: edbus_connection_name_owner_monitor (edbus_core.c:520)
==22814==    by 0x4055F63: _edbus_signal_handler_clean (edbus_signal_handler.c:217)
==22814==    by 0x40564F8: edbus_signal_handler_del (edbus_signal_handler.c:279)
==22814==    by 0x4043088: _edbus_connection_unref (edbus_core.c:1045)
==22814==    by 0x404352F: edbus_connection_unref (edbus_core.c:1105)
==22814==    by 0x80498AA: main (banshee.c:233)
==22814==  Address 0x44bea48 is 0 bytes inside a block of size 72 free'd
==22814==    at 0x402C06C: free (in /usr/lib/valgrind/vgpreload_memcheck-x86-linux.so)
==22814==    by 0x4056118: _edbus_signal_handler_del (edbus_signal_handler.c:249)
==22814==    by 0x4056401: edbus_signal_handler_unref (edbus_signal_handler.c:272)
==22814==    by 0x4056503: edbus_signal_handler_del (edbus_signal_handler.c:280)
==22814==    by 0x4043088: _edbus_connection_unref (edbus_core.c:1045)
==22814==    by 0x404352F: edbus_connection_unref (edbus_core.c:1105)
==22814==    by 0x80498AA: main (banshee.c:233)
==22814==
CRI<22814>: src/lib/edbus_signal_handler.c:278 edbus_signal_handler_del() *** Eina Magic Check Failed !!!
    Input handle has already been freed!
    *** NAUGHTY PROGRAMMER!!!
    *** SPANK SPANK SPANK!!!
    *** Now go fix your code. Tut tut tut!

Patch by: José Roberto de Souza  <zehortigoza@profusion.mobi>



SVN revision: 80686
2012-12-11 19:50:01 +00:00
José Roberto de Souza 4327109500 edbus: Refactor edbus_connection_name
Simplifications on "monitor" of NameOwnerChanged
Life cycle tied with refcount, objs, and name_owner_changed list.

Patch by: José Roberto de Souza  <zehortigoza@profusion.mobi>



SVN revision: 80684
2012-12-11 19:49:46 +00:00
José Roberto de Souza d5dab6de7b edbus: Handle 'unref signal handler inside of own callback' with ref and unref
This way is much simpler and doesn't generate many events when main loop
is quit inside of a signal handler callback.

Patch by: José Roberto de Souza  <zehortigoza@profusion.mobi>



SVN revision: 80683
2012-12-11 19:49:42 +00:00
José Roberto de Souza 7115dfa939 edbus: Use edbus_connection_name_get() instead of try find and alloc
Patch by: José Roberto de Souza  <zehortigoza@profusion.mobi>



SVN revision: 80682
2012-12-11 19:49:37 +00:00
Sebastian Dransfeld 5b3ac2cb0c edbus: prevent segv
SVN revision: 78816
2012-11-02 02:49:24 +00:00
José Roberto de Souza 4de063a9fb edbus: Make on_name_owner_changed() return upon error getting args
Patch by: José Roberto de Souza  <zehortigoza@profusion.mobi>



SVN revision: 78626
2012-10-29 22:02:46 +00:00
José Roberto de Souza 959cc5ade9 edbus: Remove unnecessary define
Patch by: José Roberto de Souza  <zehortigoza@profusion.mobi>



SVN revision: 78625
2012-10-29 22:02:41 +00:00
José Roberto de Souza f0532b7643 edbus: Add missed eina_magic names
Patch by: José Roberto de Souza  <zehortigoza@profusion.mobi>



SVN revision: 78624
2012-10-29 22:02:36 +00:00
Lucas De Marchi 6d2bd31902 edbus: Remove space after for-like macros
SVN revision: 78262
2012-10-19 18:24:30 +00:00
José Roberto de Souza de5d201e7e edbus: Add flag to name_owner_changed_callback_add to
allow initial call

Patch by: José Roberto de Souza  <zehortigoza@profusion.mobi>



SVN revision: 77338
2012-10-02 21:41:58 +00:00
José Roberto de Souza c2e818bd3f edbus: Call callback if already have a unique id when
another callback is added

Patch by: José Roberto de Souza  <zehortigoza@profusion.mobi>



SVN revision: 77337
2012-10-02 21:41:53 +00:00
Lucas De Marchi 5934eb6788 Add new edbus library, aka e_dbus v2
SVN revision: 76775
2012-09-17 20:41:05 +00:00