diff options
author | Friedemann Kleint <Friedemann.Kleint@qt.io> | 2020-01-14 09:26:46 +0100 |
---|---|---|
committer | Friedemann Kleint <Friedemann.Kleint@qt.io> | 2020-01-14 09:54:19 +0100 |
commit | 01d24eea09e1312e9fa7eee98e98ce22ed504aba (patch) | |
tree | 1eedd14bf793f25c1251962c99b75eb1864fc08e /src/plugins/platforms | |
parent | 2f366a63b20a943ae3099605c2cdb34009ca5602 (diff) |
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>
Diffstat (limited to 'src/plugins/platforms')
-rw-r--r-- | src/plugins/platforms/windows/qwindowscontext.cpp | 13 |
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(); |