Skip to content

Commit

Permalink
Ensure removeFromTimerQueue works correctly when removing a timer tha…
Browse files Browse the repository at this point in the history
…t is the only member of the queue.
  • Loading branch information
Tom Dale authored and Charles Jolley committed Oct 21, 2009
1 parent 8404794 commit ff158c0
Showing 1 changed file with 4 additions and 3 deletions.
7 changes: 4 additions & 3 deletions frameworks/foundation/system/timer.js
Expand Up @@ -448,13 +448,14 @@ SC.Timer = SC.Object.extend(
*/
removeFromTimerQueue: function(timerQueueRoot) {
var prev = this._timerQueuePrevious, next = this._timerQueueNext ;
if (!prev && !next) return timerQueueRoot ; // not in a queue...


if (!prev && !next && timerQueueRoot !== this) return timerQueueRoot ; // not in a queue...

// else, patch up to remove...
if (prev) prev._timerQueueNext = next ;
if (next) next._timerQueuePrevious = prev ;
this._timerQueuePrevious = this._timerQueueNext = null ;
return (timerQueueRoot == this) ? next : timerQueueRoot ;
return (timerQueueRoot === this) ? next : timerQueueRoot ;
},

/** @private - schedules the timer in the queue based on the runtime. */
Expand Down

0 comments on commit ff158c0

Please sign in to comment.