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

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

    XMLWordPrintable

    Details

    • Type: Bug
    • Status: Closed
    • Priority: P1: Critical
    • Resolution: Done
    • Affects Version/s: 5.4.0 Beta
    • Fix Version/s: 5.4.0 RC
    • Component/s: QPA: Direct2D, QPA: Windows
    • Labels:
      None
    • Environment:
      Windows 7/8
    • Commits:
      3d70925ee54d06e90bea392883d230b8ae2b1782 (qtbase/5.4.0, 7.11.2014)

      Description

      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

        Attachments

          Issue Links

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

            Activity

              People

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

                Dates

                Created:
                Updated:
                Resolved:

                  Gerrit Reviews

                  There are no open Gerrit changes