Bug Tracker

Opened 7 years ago

Closed 5 years ago

Last modified 5 years ago

#6641 closed bug (fixed)

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:

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.

Change History (13)

comment:1 Changed 6 years ago by dmethvin

  • Component changed from unfiled to fx

comment:2 Changed 6 years ago by snover

  • Milestone 1.4.3 deleted

Resetting milestone to future.

comment:3 Changed 6 years ago by snover

  • Blocked by 4849 added
  • Priority set to low
  • Status changed from new to open
  • Version changed from 1.4.2 to 1.4.4

comment:4 Changed 6 years ago by timmywil

  • Milestone set to 1.next
  • Version changed from 1.4.4 to 1.6b1

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

comment:5 Changed 5 years ago by ajpiano

  • Owner set to timmywil
  • Status changed from open to assigned

Assigning to timmywil to potentially roll into changes with #8685

comment:6 Changed 5 years ago by timmywil

  • Milestone changed from 1.next to 1.7

comment:7 Changed 5 years ago by gnarf

#9474 is a duplicate of this ticket.

comment:8 Changed 5 years ago by timmywil

  • Resolution set to fixed
  • Status changed from assigned to 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.

comment:9 Changed 5 years ago by gnarf

#10235 is a duplicate of this ticket.

comment:10 Changed 5 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 5 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 5 years ago by timmywil

  • Blocked by 4849 removed
  • Resolution fixed deleted
  • Status changed from closed to 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 5 years ago by timmywil

  • Resolution set to fixed
  • Status changed from reopened to closed

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

Note: See TracTickets for help on using tickets.