fix: store controller listener for disposal and recreate ticker on restart#34
Open
FinSchuiling wants to merge 1 commit intoben-fornefeld:mainfrom
Open
fix: store controller listener for disposal and recreate ticker on restart#34FinSchuiling wants to merge 1 commit intoben-fornefeld:mainfrom
FinSchuiling wants to merge 1 commit intoben-fornefeld:mainfrom
Conversation
…start Two bugs fixed: 1. The anonymous closure added to controller.isAnimating was never removed in dispose(), causing stale callbacks (and potential setState-after-dispose crashes) when the widget is removed while the controller outlives it. Fix: store the listener reference in _controllerListener and remove it in dispose(). 2. After calling _ticker.stop(), calling _ticker.start() again hits Flutter's "Ticker already started" assertion because a stopped Ticker cannot be restarted. Fix: when the controller requests animation to resume after a stop, create a fresh Ticker via _initTicker() instead of calling start() on the existing one. Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
4 tasks
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Summary
Two bugs fixed in
AnimatedMeshGradient:Stale listener on dispose: The anonymous closure added to
controller.isAnimatingwas never removed indispose(), causing stale callbacks (and potentialsetState-after-dispose crashes) when the widget is removed while the controller outlives it. Fix: store the listener reference in_controllerListenerand remove it indispose().Ticker restart assertion: After calling
_ticker.stop(), calling_ticker.start()again hits Flutter's "Ticker already started" assertion because a stoppedTickercannot be restarted. Fix: when the controller requests animation to resume after a stop, create a freshTickervia_initTicker()instead of callingstart()on the existing one.Test plan
setStateafter dispose errors)🤖 Generated with Claude Code