[webkit-dev] Timer bug ?

Mike Emmel mike.emmel at gmail.com
Mon Mar 17 18:39:55 PDT 2008


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