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

QObject::timerEvent may be called before the timer elapsed

XMLWordPrintable

    • Windows
    • 66a76da0a (dev), 21e9875d6 (dev), 701263379 (6.8), 7e5f80ebb (tqtc/lts-6.5)
    • Foundation Sprint 116, Foundation Sprint 117

      QObject::timerEvent may be called before the timer elapsed because timer ids are aggressively reused by Qt's timers. This issue can happen if

      • A timer was recently stopped
      • There are remaining WM_TIMER events in the Windows event queue
      • QObject::startTimer is used to create a new timer

      Under these conditions, QObject::startTimer will likely reuse the timer id of the previously stopped timer. This causes premature execution of QObject::timerEvent when the lingering WM_TIMER is processed.

      This can for example cause premature false return from QSignalSpy even if no signals were received, which leads to flaky tests.

      See also

        For Gerrit Dashboard: QTBUG-124496
        # Subject Branch Project Status CR V

            manordheim Mårten Nordheim
            johanseg Jøger Hansegård
            Vladimir Minenko Vladimir Minenko
            Votes:
            6 Vote for this issue
            Watchers:
            10 Start watching this issue

              Created:
              Updated:
              Resolved: