summaryrefslogtreecommitdiffstats
path: root/src/plugins/platforms/windows/qwindowscontext.cpp
diff options
context:
space:
mode:
authorQt Forward Merge Bot <qt_forward_merge_bot@qt-project.org>2020-01-15 01:00:38 +0100
committerQt Forward Merge Bot <qt_forward_merge_bot@qt-project.org>2020-01-15 01:00:39 +0100
commitc3123c757a2301445ac286ce2c8af20959151e21 (patch)
treec8f5421725d0fe0cfe8a29136937e54d6f3f95c2 /src/plugins/platforms/windows/qwindowscontext.cpp
parent2cbc5f6f7ae8ba580126a7cafc1898377c2a2407 (diff)
parent7a59d6f138ff8799170cc03d709525ab965d703a (diff)
Merge remote-tracking branch 'origin/5.14' into 5.15
Diffstat (limited to 'src/plugins/platforms/windows/qwindowscontext.cpp')
-rw-r--r--src/plugins/platforms/windows/qwindowscontext.cpp13
1 files changed, 5 insertions, 8 deletions
diff --git a/src/plugins/platforms/windows/qwindowscontext.cpp b/src/plugins/platforms/windows/qwindowscontext.cpp
index a2dd25f8cc..d31352b854 100644
--- a/src/plugins/platforms/windows/qwindowscontext.cpp
+++ b/src/plugins/platforms/windows/qwindowscontext.cpp
@@ -604,15 +604,12 @@ QString QWindowsContext::registerWindowClass(QString cname,
// each one has to have window class names with a unique name
// The first instance gets the unmodified name; if the class
// has already been registered by another instance of Qt then
- // add a UUID.
- static int classExists = -1;
-
+ // add a UUID. The check needs to be performed for each name
+ // in case new message windows are added (QTBUG-81347).
const auto appInstance = static_cast<HINSTANCE>(GetModuleHandle(nullptr));
- if (classExists == -1) {
- WNDCLASS wcinfo;
- classExists = GetClassInfo(appInstance, reinterpret_cast<LPCWSTR>(cname.utf16()), &wcinfo);
- classExists = classExists && wcinfo.lpfnWndProc != proc;
- }
+ WNDCLASS wcinfo;
+ const bool classExists = GetClassInfo(appInstance, reinterpret_cast<LPCWSTR>(cname.utf16()), &wcinfo) == TRUE
+ && wcinfo.lpfnWndProc != proc;
if (classExists)
cname += QUuid::createUuid().toString();