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

QTimer::isActive returns true if interval is Invalid

    XMLWordPrintable

Details

    • Linux/Wayland, Linux/X11
    • 1
    • 612b67cf1 (dev), 40e56294f (6.7), 148ec9eb9 (6.6), 858e5f3ee (tqtc/lts-6.5)
    • Foundation Sprint 101

    Description

      Calling QTimer::start with negative values will not start any timer but instead print the warning from QObject::startTimer. However QTimer::isActive will return true even though it's not really running

      This can produce some nasty bugs in conjunction with QTBUG-67383

      For example simplified:

      QTimer timer;
      timer.setSingleShot(true);
      connect(&timer, QTimer::timeout, &doTheThing);
      [...]
      // Somehere else
      void scheduleDoingTheThing()
          if (timer.isActive())
          // Don't do the thing yet, timer still running
               return;
          std::chrono::milliseconds interval(biggerthanintmax); // actually result of a calculation
          timer.start(interval)
      

      Attachments

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

        Activity

          People

            ivan.solovev Ivan Solovev
            davidre David Redondo
            Vladimir Minenko Vladimir Minenko
            Alex Blasche Alex Blasche
            Votes:
            0 Vote for this issue
            Watchers:
            3 Start watching this issue

            Dates

              Created:
              Updated:
              Resolved:

              Gerrit Reviews