Skip to content

Commit

Permalink
Windows QPA: Fix co-existence of several Qt versions in an application
Browse files Browse the repository at this point in the history
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 <[email protected]>
  • Loading branch information
FriedemannKleint committed Jan 14, 2020
1 parent 2f366a6 commit 01d24ee
Showing 1 changed file with 5 additions and 8 deletions.
13 changes: 5 additions & 8 deletions src/plugins/platforms/windows/qwindowscontext.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -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();
Expand Down

0 comments on commit 01d24ee

Please sign in to comment.