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

QTimer::remainingTime() can return big negative ints

    XMLWordPrintable

Details

    • Bug
    • Resolution: Done
    • P3: Somewhat important
    • 5.5.1
    • 5.3.2
    • Core: Event loop
    • None
    • Qt5.3.2/msvc2010_opengl
      See qtdiagsave.txt
    • 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

              thiago Thiago Macieira
              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