Skip to main content

Bug Tracker

Side navigation

#6641 closed bug (fixed)

Opened June 07, 2010 08:46AM UTC

Closed October 09, 2011 08:50PM UTC

Last modified March 08, 2012 10:25PM UTC

Calling stop() within animation finished callback causes other animations to freeze

Reported by: camtarn Owned by: timmywil
Priority: low Milestone: 1.7
Component: effects Version: 1.6b1
Keywords: animation, stop, freeze Cc:
Blocked by: Blocking:

The jQuery.fx tick() function removes an animation's timer from the timer list when the animation stops. However, if there is a call to stop() on the animated element within the animation's callback function, the call to stop() will remove the timer from the list and the tick() function will cause the next timer in the list to be removed instead, causing another animation on the page to freeze.

This could be solved either by documenting that stop() should not be called on the animation that fired the callback (after all, the animation is already stopped so the stop() call should not do anything), or by having tick() check that the animation which stopped is still in the queue before removing it.

I've attached a minimal test case for the bug, and a patch for tick().

Bug #4849 may be partially related to this bug.

Attachments (2)
Change History (13)

Changed June 12, 2010 01:33AM UTC by dmethvin comment:1

component: unfiledfx

Changed November 12, 2010 02:40AM UTC by snover comment:2

milestone: 1.4.3

Resetting milestone to future.

Changed November 21, 2010 01:08AM UTC by snover comment:3

blockedby: → 4849
priority: → low
status: newopen

Changed April 17, 2011 07:49PM UTC by timmywil comment:4

milestone: →

Confirmed. Here's a fiddle:

Changed July 12, 2011 04:27PM UTC by ajpiano comment:5

owner: → timmywil
status: openassigned

Assigning to timmywil to potentially roll into changes with #8685

Changed July 12, 2011 04:28PM UTC by timmywil comment:6

milestone: 1.next1.7

Changed July 12, 2011 05:23PM UTC by gnarf comment:7

#9474 is a duplicate of this ticket.

Changed September 19, 2011 07:43PM UTC by timmywil comment:8

resolution: → fixed
status: assignedclosed

Animation state is tracked on toggled/stopped animations using the private data cache. Fixes #8685. See full commit message for more. Fixes #6641.

  • Check the completed timer has not been removed already so other timers do not get accidentally removed. Fixes #6641.
  • Style edits, code reductions, and optimizations for the effects module

Changeset: 1878885fb7a09b65d95980a9b7dce2df2944e4f9

Changed September 20, 2011 04:39AM UTC by gnarf comment:9

#10235 is a duplicate of this ticket.

Changed October 09, 2011 12:19PM UTC by comment:10

I can still produce chaos in the exmaple ( ), by clicking randomly on the "New Slide with stop" button. Sometimes animation gets stuck in the middle, and can not be recoverd without the reset button (animation will then only happen between 0 and 20% for example).

Here is an example, where you can reproduce the problem in no time: (running on the current (2011/9/11) git version of jquery)

I don't know whether this is exactly the case that this ticket is about, but all other better matching tickets have been closed as dupplicates of this one.

I think this should be reopened

Changed October 09, 2011 01:24PM UTC by comment:11

I think in fact, one can reduce the problem to simply calling .stop().fadeIn() .stop().fadeOut() .stop().fadeIn in this order, which should lead to a fade in, but doesn't.

Changed October 09, 2011 08:49PM UTC by timmywil comment:12

blockedby: 4849
resolution: fixed
status: closedreopened

I've looked into this a bit and it does not seem related to toggling. I haven't been able to reproduce this with random clicks (meaning it has not gotten stuck in the middle for me), only when the calls are in direct succession. That leads me to believe it has something to do with the timer on the animation itself, or perhaps the asynchronous call in the mark deferred. Reopening so we can dig in further.

Changed October 09, 2011 08:50PM UTC by timmywil comment:13

resolution: → fixed
status: reopenedclosed

Sorry, the issue is not related to this ticket. I'll create a new one.