Timer.update was calling the TimerEvent callback even if TimerEvent.pendingDelete was already set to true, causing timer events to stack-up in cases where a new TimerEvent was generated in the callback (thanks @clowerweb #838)

This commit is contained in:
photonstorm 2015-02-11 14:43:23 +00:00
parent 74bee324a5
commit 6b8622a336
2 changed files with 2 additions and 2 deletions

View file

@ -144,6 +144,7 @@ Thanks to @pnstickne for vast majority of this update.
* You can now tint animated Sprites in Canvas mode. Or change the texture atlas frame of a tinted Sprite or Image. Please note that this is pretty expensive (depending in the browser), as the tint is re-applied every time the *frame changes*. The Pixi tint cache has also been removed to allow for subtle tint color shifts and to avoid blowing up memory. So use this feature sparingly! But at least it does now work (#1070)
* ArcadePhysics.moveToPointer no longer goes crazy if the maxTime parameter is given and the Sprite is positioned in a larger game world (thanks @AnderbergE #1472)
* Sound.loop even when set for WebAudio wouldn't use the AudioContext loop property because Sound.start was being invoked with an offset and duration. Now if `loop` is true and no marker is being used it will use the native Web Audio loop support (#1431)
* Timer.update was calling the TimerEvent callback even if `TimerEvent.pendingDelete` was already set to `true`, causing timer events to stack-up in cases where a new TimerEvent was generated in the callback (thanks @clowerweb #838)
For changes in previous releases please see the extensive [Version History](https://github.com/photonstorm/phaser/blob/master/CHANGELOG.md).

View file

@ -81,7 +81,6 @@ Phaser.Timer = function (game, autoDestroy) {
/**
* @property {number} timeCap - If the difference in time between two frame updates exceeds this value, the event times are reset to avoid catch-up situations.
*/
// this.timeCap = 1 / 60 * 1000;
this.timeCap = 1000;
/**
@ -448,7 +447,7 @@ Phaser.Timer.prototype = {
{
while (this._i < this._len && this.running)
{
if (this._now >= this.events[this._i].tick)
if (this._now >= this.events[this._i].tick && !this.events[this._i].pendingDelete)
{
// (now + delay) - (time difference from last tick to now)
this._newTick = (this._now + this.events[this._i].delay) - (this._now - this.events[this._i].tick);