Details
-
Bug
-
Resolution: Done
-
P4: Low
-
5.14.1, 5.14.2
-
None
-
-
4857fee0fc6a9b277a779266d521d4dc1ca3bd95 (qt/qtbase/dev) 7efb907b5dc942ed610cbbcd3dacae5f1b2f4b37 (qt/qtbase/5.15)
Description
You need to create two different *.dll targets with the same Qt package (I have tested it with Qt 5.14.1 and Qt 5.14.2). Load Target_A and all is fine. Now load Target_B and you will end up in qErrnoWarning () in file "qwindowscontext.cpp" in method "QWindowsContext::registerWindowClass".
ATOM atom = RegisterClassEx(&wc);
The problem is that Target_B needs to register WNDCLASSEX which are already registered form Target_A. It has worked in previous version (Qt 5.13).
Here is the problematic bug/source
const bool classExists = GetClassInfo(appInstance, reinterpret_cast<LPCWSTR>(cname.utf16()), &wcinfo) == TRUE && wcinfo.lpfnWndProc != proc;
GetClassInfo () will return a BOOL. And the source is assuming it is fine with TRUE. But it is not. MSDN tells us
"If the function finds a matching class and successfully copies the data, the return value is nonzero."
In fact the result code is something like 4050. Which is nonzero. A BOOL is defined as an int. TRUE will not help here. The fix is
const bool classExists = GetClassInfo(appInstance, reinterpret_cast<LPCWSTR>(cname.utf16()), &wcinfo) > 0 && wcinfo.lpfnWndProc != proc;
"> 0" instead of "== TRUE"
I hope that helps.
Attachments
Issue Links
- relates to
-
QTBUG-81347 [REG->5.14] QWindowsContext::registerWindowClass can fail when the Qt libs are different versions
- Closed