summaryrefslogtreecommitdiffstats
path: root/src/plugins/platforms/windows/qwindowscontext.cpp
diff options
context:
space:
mode:
authorFriedemann Kleint <Friedemann.Kleint@qt.io>2020-05-14 12:35:46 +0200
committerFriedemann Kleint <Friedemann.Kleint@qt.io>2020-05-18 08:10:29 +0200
commit4857fee0fc6a9b277a779266d521d4dc1ca3bd95 (patch)
tree50a679f6f74eb196f4ef506abf11601b35911153 /src/plugins/platforms/windows/qwindowscontext.cpp
parentb800f3039a754f67466df5e195e70ea2821f9404 (diff)
Windows QPA: Fix window class name clash when mixing Qt libraries
Fix the check of the return value of GetClassInfo() to detect a clash when mixing libraries with identical Qt namespaces. Pick-to: 5.15 Fixes: QTBUG-84005 Change-Id: I2d13b909a85dae947c65551b7e390334c83d2e2a Reviewed-by: André de la Rocha <andre.rocha@qt.io> Reviewed-by: Oliver Wolff <oliver.wolff@qt.io>
Diffstat (limited to 'src/plugins/platforms/windows/qwindowscontext.cpp')
-rw-r--r--src/plugins/platforms/windows/qwindowscontext.cpp3
1 files changed, 2 insertions, 1 deletions
diff --git a/src/plugins/platforms/windows/qwindowscontext.cpp b/src/plugins/platforms/windows/qwindowscontext.cpp
index 20a9e2da94..5765b5aa6c 100644
--- a/src/plugins/platforms/windows/qwindowscontext.cpp
+++ b/src/plugins/platforms/windows/qwindowscontext.cpp
@@ -643,9 +643,10 @@ QString QWindowsContext::registerWindowClass(QString cname,
// has already been registered by another instance of Qt then
// add a UUID. The check needs to be performed for each name
// in case new message windows are added (QTBUG-81347).
+ // Note: GetClassInfo() returns != 0 when a class exists.
const auto appInstance = static_cast<HINSTANCE>(GetModuleHandle(nullptr));
WNDCLASS wcinfo;
- const bool classExists = GetClassInfo(appInstance, reinterpret_cast<LPCWSTR>(cname.utf16()), &wcinfo) == TRUE
+ const bool classExists = GetClassInfo(appInstance, reinterpret_cast<LPCWSTR>(cname.utf16()), &wcinfo) != FALSE
&& wcinfo.lpfnWndProc != proc;
if (classExists)