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

QEventDispatcherWin32::registerTimer: Failed to create a timer

    XMLWordPrintable

Details

    • Windows
    • 1c22f2e52e98d743c266f687d326ef7611340431 (qt/qtremoteobjects/dev) 71440c4b7a6b7036d5429147b98928fe748a915b (qt/qtremoteobjects/6.2) 16a69dc4a1dd291d14bce0a905cdc9d8bafe7c3c (qt/tqtc-qtremoteobjects/5.15)

    Description

      When waitingForFinished( ) is executed continuously with QRemoteObject, the error like this occurs.

      QEventDispatcherWin32::registerTimer: Failed to create a timer (The current process has used all of its system allowance of handles for Window Manager objects.)
      

      The reason of this is because of the following code in qremoteobjectreplica.cpp

      QConnectedReplicaImplementation::waitForFinished(...) {
      ....
      QTimer::singleShot(timeout, &loop;, SLOT(quit()));
      ..
      }
      

      Every time when waitForFinished () is executed, QTimer :: singleShot () is executed with 30000ms. QTimer :: singleShot () accumulates every time it is called because there is no way to stop the timer. If you execute waitForFinished () about 1000 times within 30000ms, the timer will run out and it will not work.

      One solution would be to correct qremoteobjectreplica.cpp as below so that the timers that are no longer needed are discarded.

      QTimer t;
      t.setSingleShot (true);
      connect (& t, & QTimer; :: timeout, & loop ;, & QEventLoop; :: quit);
      t.start (timeout);
      

      Sample code QTBUG_94570.zip is attached.
      Run the server first, then run the client.

      Attachments

        Activity

          People

            bstottle Brett Stottlemyer
            nagrohn Nahomi Gröhn (Inactive)
            Votes:
            0 Vote for this issue
            Watchers:
            6 Start watching this issue

            Dates

              Created:
              Updated:
              Resolved: