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

QObject::timerEvent may be called before the timer elapsed

    XMLWordPrintable

Details

    • Bug
    • Resolution: Unresolved
    • P1: Critical
    • None
    • 6.5, 6.7
    • Core: Event loop
    • None
    • Windows

    Description

      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

      Attachments

        Issue Links

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

          Activity

            People

              thiago Thiago Macieira
              johanseg Jøger Hansegård
              Votes:
              0 Vote for this issue
              Watchers:
              2 Start watching this issue

              Dates

                Created:
                Updated:

                Gerrit Reviews

                  There are no open Gerrit changes