summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
-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();