Windows QPA: Fix co-existence of several Qt versions in an application
Change qtbase/ef54abae43db79792b40dfdca30ac0fa1b582354 added a new dummy message window for power notification. This causes the static class name conflict check to assume there is no conflict since it does not exist in previous Qt versions. Change it to perform the for each class name. Fixes: QTBUG-81347 Change-Id: I290806d021ac7de130a41e996d03b8fb4eb2c437 Reviewed-by: Oliver Wolff <oliver.wolff@qt.io>
This commit is contained in:
parent
2f366a63b2
commit
01d24eea09
@ -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;
|
||||
}
|
||||
const bool classExists = GetClassInfo(appInstance, reinterpret_cast<LPCWSTR>(cname.utf16()), &wcinfo) == TRUE
|
||||
&& wcinfo.lpfnWndProc != proc;
|
||||
|
||||
if (classExists)
|
||||
cname += QUuid::createUuid().toString();
|
||||
|
Loading…
Reference in New Issue
Block a user