#6641 closed bug (fixed)
Calling stop() within animation finished callback causes other animations to freeze
Reported by: | camtarn | Owned by: | Timmy Willison |
---|---|---|---|
Priority: | low | Milestone: | 1.7 |
Component: | effects | Version: | 1.6b1 |
Keywords: | animation, stop, freeze | Cc: | |
Blocked by: | Blocking: |
Description
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 (15)
Changed 13 years ago by
Attachment: | animation-test.html added |
---|
comment:1 Changed 13 years ago by
Component: | unfiled → fx |
---|
comment:3 Changed 13 years ago by
Blocked by: | 4849 added |
---|---|
Priority: | → low |
Status: | new → open |
Version: | 1.4.2 → 1.4.4 |
comment:4 Changed 12 years ago by
Milestone: | → 1.next |
---|---|
Version: | 1.4.4 → 1.6b1 |
Confirmed. Here's a fiddle: http://jsfiddle.net/timmywil/uTSu8/
comment:5 Changed 12 years ago by
Owner: | set to Timmy Willison |
---|---|
Status: | open → assigned |
Assigning to timmywil to potentially roll into changes with #8685
comment:6 Changed 12 years ago by
Milestone: | 1.next → 1.7 |
---|
comment:8 Changed 12 years ago by
Resolution: | → fixed |
---|---|
Status: | assigned → closed |
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
comment:10 Changed 12 years ago by
I can still produce chaos in the exmaple ( http://jsfiddle.net/timmywil/gqZL5/24/ ), 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: http://jsfiddle.net/4WhBL/9/ (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
comment:11 Changed 12 years ago by
I think in fact, one can reduce the problem to http://jsfiddle.net/4WhBL/10/ simply calling .stop().fadeIn() .stop().fadeOut() .stop().fadeIn in this order, which should lead to a fade in, but doesn't.
comment:12 Changed 12 years ago by
Blocked by: | 4849 removed |
---|---|
Resolution: | fixed |
Status: | closed → reopened |
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.
comment:13 Changed 12 years ago by
Resolution: | → fixed |
---|---|
Status: | reopened → closed |
Sorry, the issue is not related to this ticket. I'll create a new one.
Minimal test case