diff options
author | Liang Qi <liang.qi@qt.io> | 2017-01-24 10:33:37 +0100 |
---|---|---|
committer | Oswald Buddenhagen <oswald.buddenhagen@qt.io> | 2017-01-25 20:06:06 +0100 |
commit | 318b58562ae89453fb98e8145cd0440e14ba60b0 (patch) | |
tree | 622bc032cf076b4569621032f3a3315d95c3ae88 /src/dbus | |
parent | c28fde3fdac19fd5a5f614bb7983080031c924b3 (diff) | |
parent | 79352528a1726b4551ea4d9285dd2394dd0d43da (diff) |
Merge remote-tracking branch 'origin/5.8' into dev
Conflicts:
.qmake.conf
mkspecs/common/msvc-desktop.conf
mkspecs/common/msvc-version.conf
mkspecs/common/winrt_winphone/qmake.conf
mkspecs/features/mac/default_post.prf
mkspecs/features/mac/sdk.prf
mkspecs/features/qt.prf
mkspecs/features/uikit/default_post.prf
mkspecs/features/winrt/default_pre.prf
mkspecs/winphone-arm-msvc2013/qmake.conf
mkspecs/winphone-x86-msvc2013/qmake.conf
mkspecs/winrt-arm-msvc2013/qmake.conf
mkspecs/winrt-x64-msvc2013/qmake.conf
mkspecs/winrt-x86-msvc2013/qmake.conf
qmake/generators/win32/msvc_vcproj.cpp
src/gui/kernel/qwindowsysteminterface.cpp
src/network/kernel/qhostaddress.cpp
src/plugins/platforms/mirclient/qmirclientplugin.cpp
src/plugins/platforms/mirclient/qmirclientplugin.h
src/widgets/util/qsystemtrayicon.cpp
tests/auto/widgets/itemviews/qlistview/tst_qlistview.cpp
tools/configure/Makefile.mingw
tools/configure/Makefile.win32
Done-with: Jake Petroules <jake.petroules@qt.io>
Done-with: Oswald Buddenhagen <oswald.buddenhagen@qt.io>
Change-Id: I4be3262d3994e11929d3b1ded2c3379783797dbe
Diffstat (limited to 'src/dbus')
-rw-r--r-- | src/dbus/qdbusconnection.cpp | 35 | ||||
-rw-r--r-- | src/dbus/qdbusxmlparser.cpp | 5 |
2 files changed, 40 insertions, 0 deletions
diff --git a/src/dbus/qdbusconnection.cpp b/src/dbus/qdbusconnection.cpp index f95cc3a15d..da7557d7e8 100644 --- a/src/dbus/qdbusconnection.cpp +++ b/src/dbus/qdbusconnection.cpp @@ -69,6 +69,10 @@ QT_BEGIN_NAMESPACE +#ifdef Q_OS_WIN +static void preventDllUnload(); +#endif + Q_GLOBAL_STATIC(QDBusConnectionManager, _q_manager) struct QDBusConnectionManager::ConnectionRequestData @@ -139,6 +143,10 @@ 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(); } @@ -1262,4 +1270,31 @@ QByteArray QDBusConnection::localMachineId() QT_END_NAMESPACE +#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/qdbusxmlparser.cpp b/src/dbus/qdbusxmlparser.cpp index 3618c76a1d..94223e1574 100644 --- a/src/dbus/qdbusxmlparser.cpp +++ b/src/dbus/qdbusxmlparser.cpp @@ -385,6 +385,11 @@ QDBusXmlParser::QDBusXmlParser(const QString& service, const QString& path, case QXmlStreamReader::Comment: // ignore comments and processing instructions break; + case QXmlStreamReader::Characters: + // ignore whitespace + if (xml.isWhitespace()) + break; + Q_FALLTHROUGH(); default: qDBusParserError() << "unknown token" << xml.name() << xml.tokenString(); break; |