[webkit-dev] Timer bug ?

Mike Emmel mike.emmel at gmail.com
Mon Mar 17 18:54:29 PDT 2008


Well one build give isActive as true and another does not so its
something in the build weird.


On Mon, Mar 17, 2008 at 6:39 PM, Mike Emmel <mike.emmel at gmail.com> wrote:
> I just found something that seems wrong.
>
>  When a timer callback is fired for a oneshot timer isActive is true in
>  the handler.
>
>  In my opinion it should be false.
>
>  bool TimerBase::isActive() const
>  {
>     return m_nextFireTime || (timersReadyToFire &&
>  timersReadyToFire->contains(this));
>  }
>
>
>  Its seems at least on my build that
>
>    // Setting the next fire time has a side effect of removing the
>  timer from the firing timers set.
>         double interval = timer->repeatInterval();
>         timer->setNextFireTime(interval ? fireTime + interval : 0);
>
>  Is resulting in the timer left in the heap with a zero fire time this
>  still active.
>
>  Not sure why but ....
>
>  void TimerBase::setNextFireTime(double newTime)
>  {
>     // Keep heap valid while changing the next-fire time.
>
>     if (timersReadyToFire)
>         timersReadyToFire->remove(this);
>
>     double oldTime = m_nextFireTime;
>     if (oldTime != newTime) {
>         m_nextFireTime = newTime;
>
>  Should be I think
>
>  if (!newTime || (oldTime != newTime)) {
>
>
>  It looks like two calls to stop result in the timer added back with
>  zero fire time ?
>  Not sure whats going on but...
>


More information about the webkit-dev mailing list