Skip to content

Conversation

@HansMuller
Copy link
Contributor

When the demo is disposed, stop its animation. Also made some minor code-cosmetic changes.

Added some simple progress indicator tests to ensure that the animations similarly stop.

@abarth
Copy link
Contributor

abarth commented Apr 15, 2016

LGTM

AnimationController controller;
@override
void dispose() {
_controller.stop();
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Woh. So any time we use an AnimationController in a Widget and don't implement dispose it's a bug?

Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

yes

Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

for symmetry when disposing from a dispose() function, use dispose() rather than stop().

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Animations that repeat need to be stopped. In this case the animation's status listener makes it cycle, so it definitely needed to be stopped.

The test framework verifies that tests don't leave behind running animations (thanks Ian) so a series of simple tests that run the gallery demos should catch this kind of thing.

Will file an issue and then do that.

Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

(credit for catching the leaking frame callbacks goes to adam, i just padded out the error message you get)

@HansMuller HansMuller merged commit f7cf0d9 into flutter:master Apr 15, 2016
List<Layer> layers2 = tester.layers;
expect(layers1, isNot(equals(layers2)));
});
});
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

did this test not fail before?

@Hixie
Copy link
Contributor

Hixie commented Apr 15, 2016

LGTM but add a test for the gallery app :-)

Actually might be worth making a test for the gallery app that just visits each page in turn and then quits, just to see if anything is left pending at the end.

@HansMuller HansMuller deleted the progress_indicators branch April 18, 2016 15:33
@github-actions github-actions bot locked as resolved and limited conversation to collaborators Aug 16, 2021
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

4 participants