summaryrefslogtreecommitdiff
path: root/gdbus/mainloop.c
Commit message (Collapse)AuthorAgeFilesLines
* gdbus: Add SPDX License IdentifierTedd Ho-Jeong An2020-09-211-14/+1
| | | | | | | | | | | | | | | | | This patch adds SPDX License Identifier and removes the license text. ------------------------------------- License COUNT ------------------------------------- GPL-2.0-or-later : 6 License: GPL-2.0-or-later gdbus/mainloop.c gdbus/object.c gdbus/polkit.c gdbus/client.c gdbus/watch.c gdbus/gdbus.h
* gdbus: Close private connection if setup failsLuiz Augusto von Dentz2015-04-121-0/+1
| | | | | | | | | | | Private connection should be properly closed with dbus_connection_close otherwise libdbus exits with the following error: 'The last reference on a connection was dropped without closing the connection. This is a bug in an application. See dbus_connection_unref() documentation for details. Most likely, the application was supposed to call dbus_connection_close(), since this is a private connection.'
* gdbus: Fix crash when watch is toggled or disconnectedLuiz Augusto von Dentz2014-08-201-2/+8
| | | | | | | | | | | | | | | | | | | | | | | | | | This partially reverts 510b32b7156625b9df737c916b7a7a5c6fb285b9 since it still necessary to take a reference before calling dbus_watch_handle since internally it can call watch_info_free as in the following trace: Invalid read of size 8 at 0x121085: watch_func (mainloop.c:105) by 0x4C72694: g_main_context_dispatch (gmain.c:2539) by 0x4C729C7: g_main_context_iterate.isra.23 (gmain.c:3146) by 0x4C72DC1: g_main_loop_run (gmain.c:3340) by 0x120541: main (main.c:551) Address 0x5bbcd90 is 16 bytes inside a block of size 24 free'd at 0x4A079AE: free (vg_replace_malloc.c:427) by 0x4C7837E: g_free (gmem.c:252) by 0x4F708BF: dbus_watch_set_data (dbus-watch.c:614) by 0x4F70938: _dbus_watch_unref (dbus-watch.c:132) by 0x4F6E9A7: _dbus_transport_handle_watch (dbus-transport.c:884) by 0x4F59AFB: _dbus_connection_handle_watch (dbus-connection.c:1497) by 0x4F70AF9: dbus_watch_handle (dbus-watch.c:683) by 0x121084: watch_func (mainloop.c:103) by 0x4C72694: g_main_context_dispatch (gmain.c:2539) by 0x4C729C7: g_main_context_iterate.isra.23 (gmain.c:3146) by 0x4C72DC1: g_main_loop_run (gmain.c:3340) by 0x120541: main (main.c:551)
* gdbus: Replace g_timeout_add with g_idle_addLuiz Augusto von Dentz2014-02-181-4/+1
| | | | Passing 0 as timeout to g_timeout_add should equivalent to g_idle_add.
* gdbus: Fix incorrect DBusConnection reference countingAnderson Lizardo2014-02-181-10/+4
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | Commit abfc2b0dd5c3e33abfdf1a815b16d492c1751c06 attempted to fix a crash related to improper reference counting, but the main issue was that the reference was taken only during the function call (which is usually unnecessary for single thread), but still passed a pointer to DBusConnection to a function that is called by the mainloop. This left a window where the DBusConnection can be destroyed. Fixes this crash on unit/test-gdbus-client: ==32642== Invalid read of size 4 ==32642== at 0x690D0A6: dbus_connection_ref (in /lib/i386-linux-gnu/libdbus-1.so.3.7.6) ==32642== by 0x804CEDB: message_dispatch (mainloop.c:73) ==32642== by 0x684580E: g_timeout_dispatch (gmain.c:4450) ==32642== by 0x6844A75: g_main_context_dispatch (gmain.c:3065) ==32642== by 0x6844E14: g_main_context_iterate.isra.23 (gmain.c:3712) ==32642== by 0x68452FA: g_main_loop_run (gmain.c:3906) ==32642== by 0x804C7D3: client_connect_disconnect (test-gdbus-client.c:188) ==32642== by 0x6868DB2: g_test_run_suite_internal (gtestutils.c:2067) ==32642== by 0x6868F8D: g_test_run_suite_internal (gtestutils.c:2138) ==32642== by 0x6869320: g_test_run_suite (gtestutils.c:2189) ==32642== by 0x686936B: g_test_run (gtestutils.c:1508) ==32642== by 0x696D4D2: (below main) (libc-start.c:226) ==32642== Address 0x709c6e4 is 140 bytes inside a block of size 144 free'd ==32642== at 0x67E806C: free (in /usr/lib/valgrind/vgpreload_memcheck-x86-linux.so) ==32642== by 0x692D62E: dbus_free (in /lib/i386-linux-gnu/libdbus-1.so.3.7.6) ==32642== by 0x690E1C2: ??? (in /lib/i386-linux-gnu/libdbus-1.so.3.7.6) ==32642== by 0x804AAEC: destroy_context (test-gdbus-client.c:104) ==32642== by 0x6868DB2: g_test_run_suite_internal (gtestutils.c:2067) ==32642== by 0x6868F8D: g_test_run_suite_internal (gtestutils.c:2138) ==32642== by 0x6869320: g_test_run_suite (gtestutils.c:2189) ==32642== by 0x686936B: g_test_run (gtestutils.c:1508) ==32642== by 0x696D4D2: (below main) (libc-start.c:226)
* Revert "Ensure config.h is included by using CPPFLAGS"Johan Hedberg2012-12-071-0/+4
| | | | | | | | | | | | | | This reverts commit 8a03376544b046a84301847d1594f6c3674983ff. The patch needs to be split up and the gdbus/ changes were bogus compared to the original commit message. Conflicts: Makefile.am Makefile.obexd profiles/cyclingspeed/cyclingspeed.c profiles/heartrate/heartrate.c src/error.c
* Ensure config.h is included by using CPPFLAGSLucas De Marchi2012-12-051-4/+0
| | | | | | | | | | Instead of trying to include config.h in each file over the tree and possibly forgetting to include it, give a "-include config.h" argument to the compiler so it's guaranteed that a) it will be included for all source files and b) it will be the first header included. gdbus/ directory is left out, since it would break other projects using it.
* gdbus: Fix crash when getting disconnected from the busJohan Hedberg2012-09-261-4/+5
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | When getting disconnected from the bus sometimes (maybe always?) dbus_watch_handle() can cause the "info" context to be free'd meaning that we should not try to access it after the call. The only member we need access to is the connection pointer and as the code already has a ref() call for it it's only natural to solve the issue by adding a local variable not dependent on "info". The backtrace of the crash fixed looks as follows: Invalid read of size 8 at 0x121085: watch_func (mainloop.c:105) by 0x4C72694: g_main_context_dispatch (gmain.c:2539) by 0x4C729C7: g_main_context_iterate.isra.23 (gmain.c:3146) by 0x4C72DC1: g_main_loop_run (gmain.c:3340) by 0x120541: main (main.c:551) Address 0x5bbcd90 is 16 bytes inside a block of size 24 free'd at 0x4A079AE: free (vg_replace_malloc.c:427) by 0x4C7837E: g_free (gmem.c:252) by 0x4F708BF: dbus_watch_set_data (dbus-watch.c:614) by 0x4F70938: _dbus_watch_unref (dbus-watch.c:132) by 0x4F6E9A7: _dbus_transport_handle_watch (dbus-transport.c:884) by 0x4F59AFB: _dbus_connection_handle_watch (dbus-connection.c:1497) by 0x4F70AF9: dbus_watch_handle (dbus-watch.c:683) by 0x121084: watch_func (mainloop.c:103) by 0x4C72694: g_main_context_dispatch (gmain.c:2539) by 0x4C729C7: g_main_context_iterate.isra.23 (gmain.c:3146) by 0x4C72DC1: g_main_loop_run (gmain.c:3340) by 0x120541: main (main.c:551)
* gdbus: Remove unneeded NEED_DBUS_WATCH_GET_UNIX_FD checkMarcel Holtmann2012-04-161-4/+0
|
* gdbus: Unconditionally remove D-Bus timeoutsGrant Erickson2011-03-091-3/+0
| | | | | | Address an issue in which the daemon incorrectly handles D-Bus main loop timeouts by only removing timeouts that are not enabled when D-Bus requests a timeout removal.
* gdbus: Update copyright informationMarcel Holtmann2011-01-011-1/+1
|
* gdbus: fix not handling bus disconnectsLuiz Augusto von Dentz2010-10-131-0/+4
| | | | | | | | | | | We where not dispatching data when a bus disconnects which cause Disconnected signal to not be processed and thus causing the process to either not exit or to not trigger callbacks registered with g_dbus_set_disconnect_function. To fix this now we always schedule a dispatch which will make sure data still not processed will make its way to the proper handlers even if disconnected.
* Fix the case when the requested name is already in useVinicius Costa Gomes2010-03-071-1/+5
| | | | We weren't setting the dbus error in this situation.
* Remove unneeded use of status variableMarcel Holtmann2010-01-271-8/+2
|
* Introduce g_dbus_setup_private() to gdbusForrest Zhao2010-01-271-13/+52
| | | | g_dbus_setup_private() is used to setup private DBusConnection
* Cleanup of D-Bus mainloop integrationMarcel Holtmann2010-01-021-84/+107
|
* Update copyright information of D-Bus helper libraryMarcel Holtmann2010-01-011-1/+1
|
* Port gdbus to use g_dbus_add_signal_watchLuiz Augusto Von Dentz2009-12-291-11/+10
|
* Fix D-Bus timeout handlingDaniel Orstadius2009-12-171-1/+16
| | | | | | Timeouts should also be removed in the remove_timeout callback in addition to the timeout_handler_free function. This is how dbus-glib does it and it seems to prevent crashes in certain situations.
* Fix message handling for autostart.Claudio Takahasi2009-10-291-0/+3
| | | | | | Current implementation of libdbus Request name is blocking, consequently the first incomming message that triggered the service autostart is not being processed properly.
* Fix blocking service watch initial connect handlingMarcel Holtmann2009-08-061-43/+0
|
* Update copyright informationMarcel Holtmann2009-01-011-1/+1
|
* Add missing gdbus function declarationsMarcel Holtmann2008-12-061-0/+6
|
* Change file headers for D-Bus helper libraryMarcel Holtmann2008-12-061-1/+1
|
* Add function for checking if a service is presentMarcel Holtmann2008-11-261-0/+43
|
* Fix connection disconnect functionMarcel Holtmann2008-10-171-2/+2
|
* Don't consider mainloop integration of dbus-glibMarcel Holtmann2008-06-071-14/+0
|
* Remove GDBusDisconnectFunction typeMarcel Holtmann2008-05-291-1/+1
|
* Emulate libgdbus API for mainloop integrationMarcel Holtmann2008-05-081-38/+33
|
* Move D-Bus mainloop integration into libgdbusMarcel Holtmann2008-05-081-1/+279
|
* Add skeleton for libgdbus supportMarcel Holtmann2008-05-081-0/+40