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>
This commit is contained in:
parent
b800f3039a
commit
4857fee0fc
@ -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)
|
||||
|
Loading…
Reference in New Issue
Block a user