#11 do_iteration doesn't seem thread safe

Andreas Volz
Library (8)

I am using the DBus::BusDispatcher. If do_iteration is called in a thread while another thread calls dbus methods, a segmentation fault might occurs.

In such case, I have the following backtrace:
Program received signal SIGSEGV, Segmentation fault.
_dbus_watch_invalidate (watch=0x0) at dbus-watch.c:154
(gdb) backtrace

0 _dbus_watch_invalidate (watch=0x0) at dbus-watch.c:154

1 0x001863fa in free_watches (transport=0x807d478) at dbus-transport-socket.c:83

2 0x00186471 in socket_disconnect (transport=0x807d478) at dbus-transport-socket.c:987

3 0x00184749 in _dbus_transport_disconnect (transport=0x807d478) at dbus-transport.c:507

4 0x001850c0 in _dbus_transport_queue_messages (transport=0x807d478) at dbus-transport.c:1156

5 0x0016a247 in _dbus_connection_get_dispatch_status_unlocked (connection=0x807d8b0) at dbus-connection.c:4224

6 0x0016e3c2 in _dbus_connection_block_pending_call (pending=0xb6c00498) at dbus-connection.c:2423

7 0x0017e711 in dbus_pending_call_block (pending=0xb6c00498) at dbus-pending-call.c:706

8 0x0016d7e0 in dbus_connection_send_with_reply_and_block (connection=0x807d8b0, message=0x807dc50, timeout_milliseconds=-1, error=0xbffff080) at dbus-connection.c:3556

9 0x00148f72 in DBus::Connection::send_blocking (this=0x807cff8, msg=..., timeout=-1) at connection.cpp:370

10 0x00141755 in DBus::ObjectProxy::_invoke_method (this=0x807cff4, call=...) at object.cpp:340

11 0x0013ea84 in DBus::InterfaceProxy::invoke_method (this=0x807cfb4, call=...) at interface.cpp:158

12 0x004b8ec5 in org::freedesktop::KaffeinePlayer_proxy::GetStatus (this=0x807cfb4) at src/plugin_kaffeine_player-glue.h:85

13 0x004b789d in Hci::Plugin_Kaffeine::get_Is_Running (this=0x807cf48) at src/plugin_kaffeine.cpp:68

14 0x08061fe5 in Hci::HciDaemon::mainActions (this=0xbffff284) at src/daemon/hciDaemon.cpp:481

15 0x08060061 in main (argc=1, argv=0xbffff394) at src/main.cpp:22

16 0x0032de37 in libc_start_main (main=0x805ffb0 <main(int, char**)="">, argc=1, ubp_av=0xbffff394, init=0x806d5a0 <libc_csu_init>, fini=0x806d600 <__libc_csu_fini>, rtld_fini=0x11ea50, stack_end=0xbffff38c) at libc-start.c:226

17 0x0805ff11 in _start ()

I am probably not using the library the way I'm supposed to. So I'm not sure if it is really a bug.