diff options
Diffstat (limited to 'src/dbus')
-rw-r--r-- | src/dbus/dbus.pro | 10 | ||||
-rw-r--r-- | src/dbus/qdbusconnection.cpp | 35 | ||||
-rw-r--r-- | src/dbus/qdbusservicewatcher.h | 1 |
3 files changed, 6 insertions, 40 deletions
diff --git a/src/dbus/dbus.pro b/src/dbus/dbus.pro index fa67fc17ef..c50f0b6b9c 100644 --- a/src/dbus/dbus.pro +++ b/src/dbus/dbus.pro @@ -3,15 +3,15 @@ QT = core-private CONFIG += link_pkgconfig MODULE_CONFIG = dbusadaptors dbusinterfaces -!contains(QT_LIBS_DBUS, .*dbus-1.*) { - win32:CONFIG(debug, debug|release):QT_LIBS_DBUS += -ldbus-1d - else:QT_LIBS_DBUS += -ldbus-1 +!contains(QMAKE_LIBS_DBUS, .*dbus-1.*) { + win32:CONFIG(debug, debug|release):QMAKE_LIBS_DBUS += -ldbus-1d + else:QMAKE_LIBS_DBUS += -ldbus-1 } DEFINES += DBUS_API_SUBJECT_TO_CHANGE -QMAKE_CXXFLAGS += $$QT_CFLAGS_DBUS +QMAKE_CXXFLAGS += $$QMAKE_CFLAGS_DBUS contains(QT_CONFIG, dbus-linked) { - LIBS_PRIVATE += $$QT_LIBS_DBUS + LIBS_PRIVATE += $$QMAKE_LIBS_DBUS DEFINES += QT_LINKED_LIBDBUS } diff --git a/src/dbus/qdbusconnection.cpp b/src/dbus/qdbusconnection.cpp index bd25d8a6bf..cddb7dfb95 100644 --- a/src/dbus/qdbusconnection.cpp +++ b/src/dbus/qdbusconnection.cpp @@ -69,10 +69,6 @@ QT_BEGIN_NAMESPACE -#ifdef Q_OS_WIN -static void preventDllUnload(); -#endif - Q_GLOBAL_STATIC(QDBusConnectionManager, _q_manager) // can be replaced with a lambda in Qt 5.7 @@ -161,10 +157,6 @@ QDBusConnectionManager::QDBusConnectionManager() this, &QDBusConnectionManager::createServer, Qt::BlockingQueuedConnection); moveToThread(this); // ugly, don't do this in other projects -#ifdef Q_OS_WIN - // prevent the library from being unloaded on Windows. See comments in the function. - preventDllUnload(); -#endif defaultBuses[0] = defaultBuses[1] = Q_NULLPTR; start(); } @@ -1290,31 +1282,4 @@ QT_END_NAMESPACE #include "qdbusconnection.moc" -#ifdef Q_OS_WIN -# include <qt_windows.h> - -QT_BEGIN_NAMESPACE -static void preventDllUnload() -{ - // Thread termination is really wacky on Windows. For some reason we don't - // understand, exiting from the thread may try to unload the DLL. Since the - // QDBusConnectionManager thread runs until the DLL is unloaded, we've got - // a deadlock: the main thread is waiting for the manager thread to exit, - // but the manager thread is attempting to acquire a lock to unload the DLL. - // - // We work around the issue by preventing the unload from happening in the - // first place. - // - // For this trick, see - // https://blogs.msdn.microsoft.com/oldnewthing/20131105-00/?p=2733 - - static HMODULE self; - GetModuleHandleEx(GET_MODULE_HANDLE_EX_FLAG_FROM_ADDRESS | - GET_MODULE_HANDLE_EX_FLAG_PIN, - reinterpret_cast<const wchar_t *>(&self), // any address in this DLL - &self); -} -QT_END_NAMESPACE -#endif - #endif // QT_NO_DBUS diff --git a/src/dbus/qdbusservicewatcher.h b/src/dbus/qdbusservicewatcher.h index a785c89761..b7de1b22e8 100644 --- a/src/dbus/qdbusservicewatcher.h +++ b/src/dbus/qdbusservicewatcher.h @@ -63,6 +63,7 @@ public: WatchForOwnerChange = 0x03 }; Q_DECLARE_FLAGS(WatchMode, WatchModeFlag) + Q_FLAG(WatchMode) explicit QDBusServiceWatcher(QObject *parent = Q_NULLPTR); QDBusServiceWatcher(const QString &service, const QDBusConnection &connection, |