dbus-cpp's atexit handler interferes with other users of libdbus (such as Qt)

Bug #1422304 reported by James Henstridge
6
This bug affects 1 person
Affects Status Importance Assigned to Milestone
Canonical System Image
Fix Released
High
Thomas Voß
dbus-cpp
Fix Released
High
Thomas Voß

Bug Description

When starting up, dbus-cpp calls init_libdbus_thread_support_and_install_shutdown_handler(), which sets up an atexit handler to call dbus_shutdown(), which clears libdbus's internal state and invalidates any connections, etc created before hand.

For programs that also bring in Qt's D-Bus implementation (which is also built on top of libdbus), it isn't uncommon for dbus calls to be made subsequent to the atexit() handler being called, which results in errors like the following:

    process 8495: arguments to dbus_connection_close() were incorrect, assertion "connection->generation == _dbus_current_generation" failed in file ../../dbus/dbus-connection.c line 2935.
    This is normally a bug in some application using the D-Bus library.

Ideally, the atexit handler should be removed from dbus-cpp, and add explicit dbus_shutdown() calls to the test suite to check for memory leaks. There is no real benefit to calling the function in production code, and causes real pain when mixing with Qt.

Related branches

Changed in dbus-cpp:
status: New → Confirmed
importance: Undecided → High
assignee: nobody → Thomas Voß (thomas-voss)
Changed in canonical-devices-system-image:
status: New → Fix Committed
importance: Undecided → High
assignee: nobody → Thomas Voß (thomas-voss)
milestone: none → ww02-2016
Changed in dbus-cpp:
status: Confirmed → Fix Committed
Changed in canonical-devices-system-image:
status: Fix Committed → Fix Released
Changed in dbus-cpp:
status: Fix Committed → Fix Released
To post a comment you must log in.
This report contains Public information  
Everyone can see this information.

Other bug subscribers

Remote bug watches

Bug watches keep track of this bug in other bug trackers.