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

Windows/direct2d: After opening enough windows, the event queue blocks

XMLWordPrintable

    • Icon: Bug Bug
    • Resolution: Done
    • Icon: P1: Critical P1: Critical
    • 5.4.0 RC
    • 5.4.0 Beta
    • QPA: Direct2D, QPA: Windows
    • None
    • Windows 7/8
    • 3d70925ee54d06e90bea392883d230b8ae2b1782 (qtbase/5.4.0, 7.11.2014)

      The following test case, when run on the direct2d platform plugin, enter a state where the event loop enters the system event processing loop, but does not wake up and deliver events to the application. The only thing that seems to work is resizing the window (to a larger size) to trigger a WM_PAINT which eventually wakes the event loop.

      int main(int argc, char *argv[]) {
          QGuiApplication app(argc, argv);
      
          for (int i = 0; i < 31; ++i) {
              QWindow *window = new QWindow;
              window->show();
          }
      
          return app.exec();
      }
      

      After the window is resized, all the events which were waiting to be delivered (clicks, etc.) suddenly are.

      Another related test case reveals the same behavior by creating new windows from an event filter. Holding any key will create windows continuously until the event loop blocks. Then, no new window are created until one of the windows is resized:

      class EventFilter : public QObject
      {
      protected:
          bool eventFilter(QObject *obj, QEvent *event) Q_DECL_OVERRIDE
          {
              if (event->type() == QEvent::KeyPress) {
                  QWindow *window = new QWindow;
                  window->show();
              }
              return QObject::eventFilter(obj, event);
          }
      };
      
      int main(int argc, char *argv[]) {
          QGuiApplication app(argc, argv);
      
          EventFilter filter;
          app.installEventFilter(&filter);
      
          return app.exec();
      }
      

      Relevant commit: a4ac4b32 QWindowsGuiEventDispatcher: "Register timers in constructor". https://codereview.qt-project.org/#/c/97016/ for QTBUG-40881

        1. qtbug42428.zip
          2 kB
          Friedemann Kleint
        For Gerrit Dashboard: QTBUG-42428
        # Subject Branch Project Status CR V

            andrew.knight Andrew Knight
            andrew.knight Andrew Knight
            Votes:
            1 Vote for this issue
            Watchers:
            3 Start watching this issue

              Created:
              Updated:
              Resolved:

                There are no open Gerrit changes