Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Convert AnimatedSize to a StatefulWidget #80554

Merged
merged 1 commit into from Apr 22, 2021

Conversation

jason-simmons
Copy link
Member

This fixes a memory leak in which RenderAnimatedSize instances were
creating tickers in the TickerProvider but were not disposing them.

@flutter-dashboard
Copy link

It looks like this pull request may not have tests. Please make sure to add tests before merging. If you need an exemption to this rule, contact Hixie on the #hackers channel in Chat.

If you are not sure if you need tests, consider this rule of thumb: the purpose of a test is to make sure someone doesn't accidentally revert the fix. Ask yourself, is there anything in your PR that you feel it is important we not accidentally revert back to how it was before your fix?

Reviewers: Read the Tree Hygiene page and make sure this patch meets those guidelines before LGTMing.

@flutter-dashboard flutter-dashboard bot added framework flutter/packages/flutter repository. See also f: labels. team Infra upgrades, team productivity, code health, technical debt. See also team: labels. labels Apr 16, 2021
@google-cla google-cla bot added the cla: yes label Apr 16, 2021
Copy link
Member

@goderbauer goderbauer left a comment

Choose a reason for hiding this comment

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

LGTM

this.alignment = Alignment.center,
this.curve = Curves.linear,
required this.duration,
this.reverseDuration,
required this.vsync,
@Deprecated('Ignored') TickerProvider? vsync,
Copy link
Member

Choose a reason for hiding this comment

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

nit: these deprecation notices need to follow a certain pattern, see "Breaking Changes" in the wiki.

Copy link
Member Author

Choose a reason for hiding this comment

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

done

@@ -49,21 +50,23 @@ import 'framework.dart';
/// See also:
///
/// * [SizeTransition], which changes its size based on an [Animation].
class AnimatedSize extends SingleChildRenderObjectWidget {
/// Creates a widget that animates its size to match that of its child.
Copy link
Member

Choose a reason for hiding this comment

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

keep some doc on the constructor?

Copy link
Member Author

Choose a reason for hiding this comment

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

done

}

class _AnimatedSize extends SingleChildRenderObjectWidget {
/// Creates a widget that animates its size to match that of its child.
Copy link
Member

Choose a reason for hiding this comment

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

this doc can probably be removed since the constructor is private and this doesn't contain much information...

Copy link
Member Author

Choose a reason for hiding this comment

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

done

@jason-simmons jason-simmons force-pushed the animated_size_leak_2 branch 2 times, most recently from 259bcf7 to ca76263 Compare April 16, 2021 22:42
jason-simmons added a commit to jason-simmons/flutter_gallery that referenced this pull request Apr 20, 2021
This is needed in order to land flutter/flutter#80554,
which will deprecate AnimatedSize.vsync
jason-simmons added a commit to jason-simmons/rainbowmonkey that referenced this pull request Apr 20, 2021
This is needed in order to land flutter/flutter#80554,
which will deprecate AnimatedSize.vsync
@jason-simmons
Copy link
Member Author

Removed the @deprecated attribute in order to simplify landing the API change.

AnimatedSize.vsync will be @deprecated in a follow-up PR.

PTAL @goderbauer

jason-simmons added a commit to jason-simmons/flutter_gallery that referenced this pull request Apr 21, 2021
This is needed in order to land flutter/flutter#80554,
which will deprecate AnimatedSize.vsync
Copy link
Member

@goderbauer goderbauer left a comment

Choose a reason for hiding this comment

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

LGTM

this.alignment = Alignment.center,
this.curve = Curves.linear,
required this.duration,
this.reverseDuration,
required this.vsync,
// This field is now ignored and will be deprecated.
Copy link
Member

Choose a reason for hiding this comment

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

Can you phrase this as a "TODO(xx): deprecate when customer tests are updated"?

Copy link
Member Author

Choose a reason for hiding this comment

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

done

This fixes a memory leak in which RenderAnimatedSize instances were
creating tickers in the TickerProvider but were not disposing them.
@fluttergithubbot fluttergithubbot merged commit a21a22a into flutter:master Apr 22, 2021
jason-simmons added a commit to flutter/gallery that referenced this pull request Apr 22, 2021
This is needed in order to land flutter/flutter#80554,
which will deprecate AnimatedSize.vsync
Hixie pushed a commit to jocosocial/rainbowmonkey that referenced this pull request Apr 22, 2021
This is needed in order to land flutter/flutter#80554,
which will deprecate AnimatedSize.vsync
renyou pushed a commit to renyou/flutter that referenced this pull request Apr 26, 2021
renyou added a commit that referenced this pull request Apr 26, 2021
…81076 (#81155)

* Revert "Replace some `dynamic` to `Object?` type (#80772)" (#80965)

This reverts commit 12a2e68.

* Add frontend_server_client to dependency allowlist (#80912)

* Revert "[RenderEditable] Dont paint caret when selection is invalid (#79607)" (#81076)

This reverts commit 0f8148e.

* Convert AnimatedSize to a StatefulWidget (#80554)

Co-authored-by: Jenn Magder <magder@google.com>
Co-authored-by: Jason Simmons <jason-simmons@users.noreply.github.com>
topdeveloper-dev pushed a commit to topdeveloper-dev/gallery that referenced this pull request Mar 20, 2023
This is needed in order to land flutter/flutter#80554,
which will deprecate AnimatedSize.vsync
Seven-112 pushed a commit to Seven-112/gallery that referenced this pull request May 16, 2023
This is needed in order to land flutter/flutter#80554,
which will deprecate AnimatedSize.vsync
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
framework flutter/packages/flutter repository. See also f: labels. team Infra upgrades, team productivity, code health, technical debt. See also team: labels.
Projects
None yet
Development

Successfully merging this pull request may close these issues.

None yet

3 participants