Uploaded image for project: 'Qt'
  1. Qt
  2. QTBUG-96466

[REG 5.15.2-6.2.0] Runtime crash on changing screen's scale factor

    XMLWordPrintable

    Details

    • Platform/s:
      Windows
    • Commits:
      8d6e825ddfa14f75959ae20a76e4e1a34f4faec2 (qt/qtbase/dev) bf4cf5a235ab6cdd454bb3b5169d12af5fb3725d (qt/qtbase/6.2)

      Description

      100% runtime crash when changing screen's scale factor or moving app between screens with different DPI, if app contains invisible child windows, e.g

      import QtQuick
      import QtQuick.Window
      
      Window {
          width: 640
          height: 480
          visible: true
      
          Window {
              id: childWindow
          }
      }
      

      Crash stack:

      >	qwindows.dll!QWindowsContext::windowsProc(HWND__ * hwnd, unsigned int message, QtWindows::WindowsEventType et, unsigned __int64 wParam, __int64 lParam, __int64 * result, QWindowsWindow * * platformWindowPtr) Line 1477	C++
       	qwindows.dll!qWindowsWndProc(HWND__ * hwnd, unsigned int message, unsigned __int64 wParam, __int64 lParam) Line 1702	C++
       	[External Code]	
       	Qt6Core.dll!QEventDispatcherWin32::processEvents(QFlags<enum QEventLoop::ProcessEventsFlag> flags) Line 491	C++
       	Qt6Gui.dll!QWindowsGuiEventDispatcher::processEvents(QFlags<enum QEventLoop::ProcessEventsFlag> flags) Line 73	C++
       	[Inline Frame] Qt6Core.dll!QEventLoop::processEvents(QFlags<enum QEventLoop::ProcessEventsFlag>) Line 139	C++
       	Qt6Core.dll!QEventLoop::exec(QFlags<enum QEventLoop::ProcessEventsFlag> flags) Line 232	C++
       	Qt6Core.dll!QCoreApplication::exec() Line 1378	C++
      

      Crashed in qtbase\src\plugins\platforms\windows\qwindowscontext.cpp, Line 1477
      platformChildWindow is null here

              // Scale child QPlatformWindow size. Windows sends WM_DPICHANGE to top-level windows only.
              for (QWindow *childWindow : platformWindow->window()->findChildren<QWindow *>()) {
                  QWindowsWindow *platformChildWindow = static_cast<QWindowsWindow *>(childWindow->handle());
                  QRect currentGeometry = platformChildWindow->geometry();   <--- crashed
                  QRect scaledGeometry = QRect(currentGeometry.topLeft() * scale, currentGeometry.size() * scale);
                  platformChildWindow->setGeometry(scaledGeometry);
              }
      

        Attachments

        No reviews matched the request. Check your Options in the drop-down menu of this sections header.

          Activity

            People

            Assignee:
            owolff Oliver Wolff
            Reporter:
            studiosus Vladimir Belyavsky
            Votes:
            2 Vote for this issue
            Watchers:
            6 Start watching this issue

              Dates

              Created:
              Updated:
              Resolved:

                Gerrit Reviews

                There are no open Gerrit changes