Skip to content
This repository was archived by the owner on Feb 25, 2025. It is now read-only.

Conversation

@dsafa22
Copy link

@dsafa22 dsafa22 commented Jul 14, 2021

Clear context references to avoid memory leaks

Clear context references to avoid memory leaks
@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.

@google-cla
Copy link

google-cla bot commented Jul 14, 2021

Thanks for your pull request. It looks like this may be your first contribution to a Google open source project (if not, look below for help). Before we can look at your pull request, you'll need to sign a Contributor License Agreement (CLA).

📝 Please visit https://cla.developers.google.com/ to sign.

Once you've signed (or fixed any issues), please reply here with @googlebot I signed it! and we'll verify it.


What to do if you already signed the CLA

Individual signers
Corporate signers

ℹ️ Googlers: Go here for more info.

@google-cla google-cla bot added the cla: no label Jul 14, 2021
@dsafa22 dsafa22 changed the title Update PlatformViewsController.java Fix memory leaks in PlatformViewsController.java Jul 14, 2021
@chinmaygarde
Copy link
Member

cc @blasten

@blasten
Copy link

blasten commented Jul 15, 2021

change LGTM, but this needs a test. Would you be able to add one?

@chinmaygarde
Copy link
Member

@blasten Do you have guidance on how to test this or if there is an existing test for this component? If not, we can followup separately on setting up a harness and land this as it looks like a real issue.

@chinmaygarde
Copy link
Member

The fix seems sound. The presubmit failures are a result of pending rebase. Per Jason, we should take ownership of this PR and land this if the OP is unable to make progress on it.

@blasten
Copy link

blasten commented Aug 5, 2021

PlatformViewsController.java is tested in PlatformViewControllerTest.java. Add another test that extends this one.

To check if contextToPlatformView is empty, make it visible to the package (e.g. remove the private modifier), and add @visibleForTesting annotation, then use onDetachedFromJNI() and onPreEngineRestart() to ensure the value is cleared.

@blasten
Copy link

blasten commented Aug 5, 2021

This will be fixed via #27915. Thanks for the PR

@blasten blasten closed this Aug 5, 2021
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.

Projects

None yet

Development

Successfully merging this pull request may close these issues.

3 participants