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

QApplication crash on second run when mouse roll over window



    • Windows
    • 41f96866ee (qt/qtbase/dev) cefe02086b (qt/qtbase/6.2) 48c9f3b391 (qt/qtbase/6.3) cefe02086b (qt/tqtc-qtbase/6.2) 48c9f3b391 (qt/tqtc-qtbase/6.3) 41f96866ee (qt/tqtc-qtbase/dev)


      Qt Widgets is often used in larger application, when a user interacion is required.
      In these cases a QApplication begins and end his life cycle many times within the main application.
      Now (Qt 6.2.2) the second run crash, but only when the mouse roll over the main window.
      Using the user interface by keyboard (close using ALT+F4) it doesn't crash.

      Affected/tested Qt versions:

      • Qt 5.12.4 MinGW - works
      • Qt 6.2.1 MinGW - crash
      • Qt 6.2.1 MSVC - crash
      • Qt 6.2.2 MinGW - crash
      • Qt 6.2.2 Ubuntu - works

      For our application it's a critical problem.

      This is the minimum code that reproduce the bug (see attachment main.cpp)

      #include <iostream>
      #include <QtWidgets>
      int qt_test(int& argc, char *argv[])
          QApplication app(argc,argv);
          QWidget window;
          window.resize(320, 240);
          window.setWindowTitle( QApplication::translate("toplevel", "UX QWidgets") );
          return app.exec(); // crash on the second run, only when the mouse roll on the window
      int main(int argc, char *argv[])
          using std::cout, std::endl;
          cout << "QApplication bug" << endl;
          int res1 = qt_test(argc, argv); // OK
          cout << "Exit first QApplication - OK, res1: " << res1 << endl;
          int res2 = qt_test(argc, argv); // crash on mouse over
          cout << "Exit second QApplication using ALT+F4 res2: " << res2 << endl;
          return 0;


      Stack trace:

       1 QPointingDevicePrivate::pointById(int) const 
       2 QGuiApplicationPrivate::processMouseEvent(QWindowSystemInterfacePrivate::MouseEvent *) 
       3 QGuiApplicationPrivate::processWindowSystemEvent(QWindowSystemInterfacePrivate::WindowSystemEvent *) 
       4 QWindowSystemInterface::sendWindowSystemEvents(QFlags<QEventLoop::ProcessEventsFlag>) 
       5 QEventDispatcherWin32::processEvents(QFlags<QEventLoop::ProcessEventsFlag>) 
       6 QWindowsGuiEventDispatcher::processEvents(QFlags<QEventLoop::ProcessEventsFlag>) 
       7 QEventLoop::exec(QFlags<QEventLoop::ProcessEventsFlag>) 
       8 QCoreApplication::exec() 
       9 qt_test main.cpp 11 
       10 main main.cpp 20



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



            vhilshei Volker Hilsheimer
            lgdev Mario Rossi
            0 Vote for this issue
            1 Start watching this issue



              Gerrit Reviews

                There are no open Gerrit changes