Merge lp:~thomas-voss/dbus-cpp/fix-1526877 into lp:dbus-cpp/15.04

Proposed by Thomas Voß
Status: Merged
Approved by: James Henstridge
Approved revision: 104
Merged at revision: 104
Proposed branch: lp:~thomas-voss/dbus-cpp/fix-1526877
Merge into: lp:dbus-cpp/15.04
Diff against target: 31 lines (+13/-1)
1 file modified
src/core/dbus/bus.cpp (+13/-1)
To merge this branch: bzr merge lp:~thomas-voss/dbus-cpp/fix-1526877
Reviewer Review Type Date Requested Status
James Henstridge Approve
PS Jenkins bot continuous-integration Pending
Review via email: mp+282332@code.launchpad.net

This proposal supersedes a proposal from 2016-01-02.

Commit message

Only run dbus_shutdown if explicitly requested by env var.

Description of the change

Only run dbus_shutdown if explicitly requested by env var.

To post a comment you must log in.
Revision history for this message
PS Jenkins bot (ps-jenkins) wrote : Posted in a previous version of this proposal
review: Needs Fixing (continuous-integration)
Revision history for this message
James Henstridge (jamesh) wrote :

Looks good!

review: Approve

Preview Diff

[H/L] Next/Prev Comment, [J/K] Next/Prev File, [N/P] Next/Prev Hunk
1=== modified file 'src/core/dbus/bus.cpp'
2--- src/core/dbus/bus.cpp 2014-11-27 16:38:44 +0000
3+++ src/core/dbus/bus.cpp 2016-01-12 16:15:46 +0000
4@@ -24,6 +24,8 @@
5 #include <core/dbus/traits/timeout.h>
6 #include <core/dbus/traits/watch.h>
7
8+#include <core/posix/this_process.h>
9+
10 #include "message_p.h"
11 #include "message_factory_impl.h"
12 #include "pending_call_impl.h"
13@@ -76,8 +78,18 @@
14
15 void init_libdbus_thread_support_and_install_shutdown_handler()
16 {
17+ static const bool install_dbus_shutdown_handler
18+ {
19+ not core::posix::this_process::env::get("DBUS_CPP_INSTALL_DBUS_SHUTDOWN_HANDLER").empty()
20+ };
21+
22 static std::once_flag once;
23- std::call_once(once, []() { dbus_threads_init_default(); std::atexit(dbus_shutdown); });
24+ std::call_once(once, []()
25+ {
26+ dbus_threads_init_default();
27+ if (install_dbus_shutdown_handler)
28+ std::atexit(dbus_shutdown);
29+ });
30 }
31 }
32

Subscribers

People subscribed via source and target branches