diff options
Diffstat (limited to 'src/CommonAPI/DBus/DBusConnection.cpp')
-rw-r--r-- | src/CommonAPI/DBus/DBusConnection.cpp | 22 |
1 files changed, 15 insertions, 7 deletions
diff --git a/src/CommonAPI/DBus/DBusConnection.cpp b/src/CommonAPI/DBus/DBusConnection.cpp index d9da52e..4206f95 100644 --- a/src/CommonAPI/DBus/DBusConnection.cpp +++ b/src/CommonAPI/DBus/DBusConnection.cpp @@ -67,13 +67,20 @@ public: } bool forceDetach(false); - if (0u != activeConnections) { - std::future<bool> ready = readyToCleanup_.get_future(); - if (ready.valid()) { - const std::future_status status = ready.wait_for(std::chrono::seconds(1)); - forceDetach = (std::future_status::ready != status); + #if defined (_MSC_VER) && (_MSC_VER < 1900) + // MSVC compiler RTL is buggy until fixed in Visual Studio 2015 + // The code crashes when doing a wait_for() in a static destructor + // So, skip the check if we have an older version of MSVC + forceDetach = true; + #else + if (0u != activeConnections) { + std::future<bool> ready = readyToCleanup_.get_future(); + if (ready.valid()) { + const std::future_status status = ready.wait_for(std::chrono::seconds(1)); + forceDetach = (std::future_status::ready != status); + } } - } + #endif { std::lock_guard<std::mutex> lock(mutex_); @@ -465,6 +472,7 @@ void DBusConnection::disconnect() { isDisconnecting_ = true; if (std::shared_ptr<CommonAPI::MainLoopContext> mainLoopContext = mainLoopContext_.lock()) { + DBusServiceRegistry::remove(shared_from_this()); Factory::get()->releaseConnection(connectionId_); } @@ -1264,7 +1272,7 @@ bool DBusConnection::removeSignalMemberHandler(const DBusSignalHandlerToken &dbu bool lastHandlerRemoved = false; std::lock_guard<std::mutex> dbusSignalHandlersLock(signalHandlersGuard_); - + auto signalHandlerPathIt = dbusSignalHandlers_.find(dbusSignalHandlerToken); if (signalHandlerPathIt != dbusSignalHandlers_.end()) { |