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

Crash when displaying QSystemTrayIcon's contextual menu with PROCESS_DPI_UNAWARE when screen resolution is > 100%

    XMLWordPrintable

Details

    • Windows
    • 9137691e745039f8ad9cdee2594a958e244ba341 (qt/qtbase/5.11.3)

    Description

      A Qt 5.10 application running on a display with a resolution set to 125%, 150% or 175% and where PROCESS_DPI_UNAWARE is set is crashing when the QSystemTrayIcon's contextual menu is displayed.

      Attached is a small test project that reproduces the crash. It:

      • calls SetProcessDpiAwareness(PROCESS_DPI_UNAWARE); in main.cpp
      • set up the contextual menu for QSystemTrayIcon in MainWindow.cpp 

       

      See attached video that exhibits the crash: screencast.mov

       

      Reproducibility:

      • This issue is reproducible with Qt 5.10.0 and Qt 5.10.1.
      • It does not occur with Qt 5.9.3.
      • Reproducible on Windows 10 with multiple machines

       

      Steps to reproduce:

      • Set your screen resolution to 125%, 150% or 175%. It does not matter if the screen is a full HD or 4K.

      • Download the attached sample project QSystemTray ( QSystemTray.zip )
      • Compile and run the application
      • Close the window of the application
      • Right click on the tray icon to display the contextual menu

      Result: The application crashes. You see in the console:

      Exception thrown: read access violation.
      **this** was 0x8.

      The backtrace is:

      Qt5Guid.dll!QScopedPointer<QObjectData,QScopedPointerDeleter<QObjectData> >::data() Line 140 C++
      Qt5Guid.dll!qGetPtrHelper<QScopedPointer<QObjectData,QScopedPointerDeleter<QObjectData> > >(const QScopedPointer<QObjectData,QScopedPointerDeleter<QObjectData> > & p) Line 1013 C++
      Qt5Guid.dll!QScreen::d_func() Line 69 C++
      Qt5Guid.dll!QScreen::geometry() Line 377 C++
      Qt5Guid.dll!QHighDpiScaling::origin(const QScreen * screen) Line 441 C++
      Qt5Widgetsd.dll!QHighDpi::fromNativePixels(const QPoint & pixelPoint, const QScreen * screen) Line 314 C++
      Qt5Widgetsd.dll!QSystemTrayIcon::setContextMenu::__l10::<lambda>(QPoint globalNativePos, const QPlatformScreen * platformScreen) Line 218 C++
      Qt5Widgetsd.dll!QtPrivate::FunctorCall<QtPrivate::IndexesList<0,1>,QtPrivate::List<QPoint,QPlatformScreen const * __ptr64>,void,void <lambda>(QPoint, const QPlatformScreen *) >::call(QSystemTrayIcon::setContextMenu::__l10::void <lambda>(QPoint, const QPlatformScreen *) & f, void * * arg) Line 130 C++
      Qt5Widgetsd.dll!QtPrivate::Functor<void <lambda>(QPoint, const QPlatformScreen *),2>::call<QtPrivate::List<QPoint,QPlatformScreen const * __ptr64>,void>(QSystemTrayIcon::setContextMenu::__l10::void <lambda>(QPoint, const QPlatformScreen *) & f, void * __formal, void * * arg) Line 241 C++
      Qt5Widgetsd.dll!QtPrivate::QFunctorSlotObject<void <lambda>(QPoint, const QPlatformScreen *),2,QtPrivate::List<QPoint,QPlatformScreen const * __ptr64>,void>::impl(int which, QtPrivate::QSlotObjectBase * this_, QObject * r, void * * a, bool * ret) Line 429 C++
      Qt5Cored.dll!QtPrivate::QSlotObjectBase::call(QObject * r, void * * a) Line 378 C++
      Qt5Cored.dll!QMetaObject::activate(QObject * sender, int signalOffset, int local_signal_index, void * * argv) Line 3754 C++
      Qt5Cored.dll!QMetaObject::activate(QObject * sender, const QMetaObject * m, int local_signal_index, void * * argv) Line 3629 C++
      Qt5Guid.dll!QPlatformSystemTrayIcon::contextMenuRequested(QPoint _t1, const QPlatformScreen * _t2) Line 194 C++
      qwindowsd.dll!QWindowsSystemTrayIcon::winEvent(const tagMSG & message, long * result) Line 388 C++
      qwindowsd.dll!qWindowsTrayIconWndProc(HWND__ * hwnd, unsigned int message, unsigned __int64 wParam, __int64 lParam) Line 143 C++
      [External Code]
      Qt5Cored.dll!QEventDispatcherWin32::processEvents(QFlags<enum QEventLoop::ProcessEventsFlag> flags) Line 563 C++
      qwindowsd.dll!QWindowsGuiEventDispatcher::processEvents(QFlags<enum QEventLoop::ProcessEventsFlag> flags) Line 74 C++
      Qt5Cored.dll!QEventLoop::processEvents(QFlags<enum QEventLoop::ProcessEventsFlag> flags) Line 135 C++
      Qt5Cored.dll!QEventLoop::exec(QFlags<enum QEventLoop::ProcessEventsFlag> flags) Line 212 C++
      Qt5Cored.dll!QCoreApplication::exec() Line 1332 C++
      Qt5Guid.dll!QGuiApplication::exec() Line 1688 C++
      Qt5Widgetsd.dll!QApplication::exec() Line 2918 C++
      QSystemTray.exe!main(int argc, char * * argv) Line 18 C++
      QSystemTray.exe!WinMain(HINSTANCE__ * __formal, HINSTANCE__ * __formal, char * __formal, int __formal) Line 104 C++
      [External Code]

       

      Attachments

        1. DisplaySettings.png
          64 kB
          user-e3f1a
        2. QSystemTray.zip
          3 kB
          user-e3f1a
        3. qtbug67966_diag.diff
          0.9 kB
          Friedemann Kleint
        4. qtbug67966.zip
          2 kB
          Friedemann Kleint
        5. screencast.mov
          6.92 MB
          user-e3f1a
        No reviews matched the request. Check your Options in the drop-down menu of this sections header.

        Activity

          People

            kleint Friedemann Kleint
            jirauser46068 user-e3f1a (Inactive)
            Votes:
            2 Vote for this issue
            Watchers:
            4 Start watching this issue

            Dates

              Created:
              Updated:
              Resolved:

              Gerrit Reviews

                There are no open Gerrit changes