efl/src/lib/eldbus
José Roberto de Souza 63abe9b00c eldbus: Fix crash when removing the last reference of the message container inside of the message callback
If user try to remove the last reference of proxy, object, connection
or eldbus(lib) inside of message callback it was causing the
eldbus_pending_dispatch() being called 2 times, one because of the
eldbus_cancel() that is triggered when the last reference of the
message parent is removed and another after the return of the user
callback.

==6545== Invalid read of size 8
==6545==    at 0x52F784E: eldbus_cbs_free_dispatch (eldbus_core.c:266)
==6545==    by 0x53064AA: eldbus_pending_dispatch (eldbus_pending.c:227)
==6545==    by 0x5305961: cb_pending (eldbus_pending.c:74)
==6545==    by 0x6B29DB1: ??? (in /usr/lib/libdbus-1.so.3.8.9)
==6545==    by 0x6B2D280: dbus_connection_dispatch (in /usr/lib/libdbus-1.so.3.8.9)
==6545==    by 0x52F93B4: eldbus_idler (eldbus_core.c:773)
==6545==    by 0x4E4B300: _ecore_call_task_cb (ecore_private.h:305)
==6545==    by 0x4E4B78F: _ecore_idler_all_call (ecore_idler.c:143)
==6545==    by 0x4E4EA73: _ecore_main_loop_spin_core (ecore_main.c:1768)
==6545==    by 0x4E4EAF1: _ecore_main_loop_spin_timers (ecore_main.c:1802)
==6545==    by 0x4E4ED01: _ecore_main_loop_iterate_internal (ecore_main.c:1925)
==6545==    by 0x4E4D03B: ecore_main_loop_begin (ecore_main.c:983)
==6545==  Address 0x701aa78 is 104 bytes inside a block of size 128 free'd
==6545==    at 0x4C2B200: free (in /usr/lib/valgrind/vgpreload_memcheck-amd64-linux.so)
==6545==    by 0x530655B: eldbus_pending_dispatch (eldbus_pending.c:241)
==6545==    by 0x5306763: eldbus_pending_cancel (eldbus_pending.c:259)
==6545==    by 0x52F29DB: _eldbus_proxy_clear (eldbus_proxy.c:146)
==6545==    by 0x52F3057: _eldbus_proxy_unref (eldbus_proxy.c:244)
==6545==    by 0x52F3393: eldbus_proxy_unref (eldbus_proxy.c:264)
==6545==    by 0x401039: on_get_playlists (banshee.c:53)
==6545==    by 0x5306493: eldbus_pending_dispatch (eldbus_pending.c:225)
==6545==    by 0x5305961: cb_pending (eldbus_pending.c:74)
==6545==    by 0x6B29DB1: ??? (in /usr/lib/libdbus-1.so.3.8.9)
==6545==    by 0x6B2D280: dbus_connection_dispatch (in /usr/lib/libdbus-1.so.3.8.9)
==6545==    by 0x52F93B4: eldbus_idler (eldbus_core.c:773)

Now we will remove the pending from parent pending list before
call the user callback, this way only the pending messages will
be canceled.

Also we need increase the eldbus reference before call
dbus_connection_dispatch() or user could remove the last reference of
eldbus inside of a message callback when we still are
holding one reference of the connection.

@fix
ref T1908
2014-12-17 17:05:35 -02:00
..
Eldbus.h eldbus: Fix wrong comments. 2014-10-21 23:42:03 +02:00
eldbus_connection.h eldbus: update missing API documentation. 2014-10-20 18:32:27 +02:00
eldbus_core.c eldbus: Fix crash when removing the last reference of the message container inside of the message callback 2014-12-17 17:05:35 -02:00
eldbus_freedesktop.c eldbus: Add eldbus_object_manager_interfaces_added/removed() 2013-09-02 16:14:47 -03:00
eldbus_freedesktop.h eldbus: update missing eldbus_freedesktop.h API documentation. 2014-10-20 18:32:28 +02:00
eldbus_message.c eldbus: Fix possible null dereference reported by Coverity 2014-12-10 13:24:54 -05:00
eldbus_message.h eldbus: update missing eldbus_message API documentation. 2014-10-20 18:32:28 +02:00
eldbus_message_eina_value.h Rename edbus->eldbus 2013-04-23 12:36:29 -03:00
eldbus_message_from_eina_value.c eldbus: Check return value of eina_value_pget 2013-12-07 21:11:33 +01:00
eldbus_message_helper.c Rename edbus->eldbus 2013-04-23 12:36:29 -03:00
eldbus_message_helper.h eldbus: update missing eldbus_message API documentation. 2014-10-20 18:32:28 +02:00
eldbus_message_to_eina_value.c eldbus: Check return value of _type_size 2013-12-07 21:11:32 +01:00
eldbus_object.c eldbus: Fix crash when removing the last reference of the message container inside of the message callback 2014-12-17 17:05:35 -02:00
eldbus_object.h eldbus: update missing eldbus_object API documentation. 2014-10-20 18:32:28 +02:00
eldbus_pending.c eldbus: Fix crash when removing the last reference of the message container inside of the message callback 2014-12-17 17:05:35 -02:00
eldbus_pending.h eldbus: update missing eldbus_pending.h API documentation. 2014-10-20 18:32:28 +02:00
eldbus_private.h eldbus: Add timeout parameter to eldbus_proxy_send_and_block() 2014-12-05 09:53:08 -05:00
eldbus_private_types.h Revert "eldbus hackaround for proxy deletion during pending callback" 2014-12-17 16:58:25 -02:00
eldbus_proxy.c eldbus: Fix crash when removing the last reference of the message container inside of the message callback 2014-12-17 17:05:35 -02:00
eldbus_proxy.h eldbus: Add timeout parameter to eldbus_proxy_send_and_block() 2014-12-05 09:53:08 -05:00
eldbus_service.c Fixes ABI breakage in Eldbus for use with C++ Eldbus 2014-07-15 08:01:14 +09:00
eldbus_service.h Fixes ABI breakage in Eldbus for use with C++ Eldbus 2014-07-15 08:01:14 +09:00
eldbus_signal_handler.c Rename edbus->eldbus 2013-04-23 12:36:29 -03:00
eldbus_signal_handler.h Rename edbus->eldbus 2013-04-23 12:36:29 -03:00