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

QTimer::remainingTime() can return big negative ints

    XMLWordPrintable

    Details

    • Type: Bug
    • Status: Closed
    • Priority: P3: Somewhat important
    • Resolution: Done
    • Affects Version/s: 5.3.2
    • Fix Version/s: 5.5.1
    • Component/s: Core: Event loop
    • Labels:
      None
    • Environment:
      Qt5.3.2/msvc2010_opengl
      See qtdiagsave.txt
    • Commits:
      d01d08971a1ba4d66927a48577041abc5b7df8a2

      Description

      According to its description, QTimer::remainingTime() should only return 0, -1 or positive int, but it can also return big negative ints if it is called before the event loop properly initialized it.

      This happened in my case when I tried to create a QTimer object in a loop inside a thread and called remainingTime() on it. The loop blocked Qts event loop from executing and the remainingTime() never properly initialized, but was instead randomly set to something like "-1371648957".

      The timer on the other hand tried to count down, which can be verified by printing the remainingTime() on the console, so the negative value just increases and timeout() is never fired.

      See this thread for more details: http://stackoverflow.com/questions/28563004/qtimer-remainingtime-returns-1371648957/28563732#28563732

      This is transparent to the user and the returned value should probably be -1.

        Attachments

          Issue Links

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

            Activity

              People

              Assignee:
              thiago Thiago Macieira
              Reporter:
              Dreiven Dreiven
              Votes:
              0 Vote for this issue
              Watchers:
              2 Start watching this issue

                Dates

                Created:
                Updated:
                Resolved:

                  Gerrit Reviews

                  There are no open Gerrit changes