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

Crash on QWindowPrivate::updateDevicePixelRatio() with nullptr access

    XMLWordPrintable

Details

    • Linux/Wayland, Linux/X11, macOS, Windows
    • fbf957de5 (dev), 29b141d88 (6.8), 721816e52 (6.7)

    Description

      There are crashes on QWindowPrivate::updateDevicePixelRatio() with nullptr access.
      We don't reproduce this locally, I only started noticing this in our users' crash reports after we upgraded to Qt 6.7.2 (from 6.5.3).

      Unhandled exception thrown: read access violation.
      **this** was nullptr.
      

      Call stack:

      >	Qt6Gui.dll!QScreen::devicePixelRatio() Line 287	C++
       	Qt6Gui.dll!QWindowPrivate::updateDevicePixelRatio() Line 1410	C++
       	[Inline Frame] Qt6Core.dll!QtPrivate::QSlotObjectBase::call(QObject *) Line 469	C++
       	Qt6Core.dll!doActivate<0>(QObject * sender, int signal_index, void * * argv) Line 4086	C++
       	Qt6Core.dll!QMetaObject::activate(QObject * sender, const QMetaObject * m, int local_signal_index, void * * argv) Line 4147	C++
       	[Inline Frame] Qt6Gui.dll!QWindow::screenChanged(QScreen * _t1) Line 817	C++
       	[Inline Frame] Qt6Gui.dll!QWindowPrivate::emitScreenChangedRecursion(QScreen *) Line 496	C++
       	Qt6Gui.dll!QWindowPrivate::setTopLevelScreen(QScreen * newScreen, bool recreate) Line 520	C++
       	Qt6Gui.dll!QWindowSystemInterface::handleScreenRemoved(QPlatformScreen * platformScreen) Line 765	C++
       	qwindows.dll!QWindowsScreenManager::handleScreenChanges() Line 812	C++
       	qwindows.dll!qDisplayChangeObserverWndProc(HWND__ * hwnd, unsigned int message, unsigned __int64 wParam, __int64 lParam) Line 676	C++
       	[External Code]	
       	Qt6Core.dll!QEventDispatcherWin32::processEvents(QFlags<enum QEventLoop::ProcessEventsFlag> flags) Line 487	C++
       	Qt6Gui.dll!QWindowsGuiEventDispatcher::processEvents(QFlags<enum QEventLoop::ProcessEventsFlag> flags) Line 37	C++
       	[Inline Frame] Qt6Core.dll!QEventLoop::processEvents(QFlags<enum QEventLoop::ProcessEventsFlag>) Line 100	C++
       	Qt6Core.dll!QEventLoop::exec(QFlags<enum QEventLoop::ProcessEventsFlag> flags) Line 181	C++
       	Qt6Core.dll!QCoreApplication::exec() Line 1486	C++
      

      Looking at the code

      bool QWindowPrivate::updateDevicePixelRatio()
      {
          Q_Q(QWindow);
      
          // If there is no platform window use the associated screen's devicePixelRatio,
          // which typically is the primary screen and will be correct for single-display
          // systems (a very common case).
          const qreal newDevicePixelRatio = platformWindow ?
              platformWindow->devicePixelRatio() * QHighDpiScaling::factor(q) : q->screen()->devicePixelRatio();
      ...
      

      it seems that under some circumstances both platformWindow and q->screen() can be null for a window.

      Attachments

        Issue Links

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

          Activity

            People

              vestbo Tor Arne Vestbø
              studiosus Vladimir Belyavsky
              Votes:
              1 Vote for this issue
              Watchers:
              8 Start watching this issue

              Dates

                Created:
                Updated:
                Resolved:

                Gerrit Reviews

                  There are no open Gerrit changes