Bug Tracker

Opened 13 years ago

Closed 12 years ago

Last modified 12 years ago

#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)

animation-test.html (1.1 KB) - added by camtarn 13 years ago.
Minimal test case
jquery-1.4.2-animation-fix.patch (388 bytes) - added by camtarn 13 years ago.
Patch for tick()

Download all attachments as: .zip

Change History (15)

Changed 13 years ago by camtarn

Attachment: animation-test.html added

Minimal test case

Changed 13 years ago by camtarn

Patch for tick()

comment:1 Changed 13 years ago by dmethvin

Component: unfiledfx

comment:2 Changed 13 years ago by snover

Milestone: 1.4.3

Resetting milestone to future.

comment:3 Changed 13 years ago by snover

Blocked by: 4849 added
Priority: low
Status: newopen
Version: 1.4.21.4.4

comment:4 Changed 12 years ago by Timmy Willison

Milestone: 1.next
Version: 1.4.41.6b1

Confirmed. Here's a fiddle: http://jsfiddle.net/timmywil/uTSu8/

comment:5 Changed 12 years ago by ajpiano

Owner: set to Timmy Willison
Status: openassigned

Assigning to timmywil to potentially roll into changes with #8685

comment:6 Changed 12 years ago by Timmy Willison

Milestone: 1.next1.7

comment:7 Changed 12 years ago by gnarf

#9474 is a duplicate of this ticket.

comment:8 Changed 12 years ago by Timmy Willison

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.

comment:9 Changed 12 years ago by gnarf

#10235 is a duplicate of this ticket.

comment:10 Changed 12 years ago by janoscharlipp@…

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 janoscharlipp@…

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 Timmy Willison

Blocked by: 4849 removed
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.

comment:13 Changed 12 years ago by Timmy Willison

Resolution: fixed
Status: reopenedclosed

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

Note: See TracTickets for help on using tickets.