Skip to content
This repository has been archived by the owner on Feb 22, 2023. It is now read-only.

[webview_flutter_android] Fixes crash when the Java InstanceManager was used after plugin was removed from engine #6943

Merged
merged 7 commits into from
Jan 14, 2023

Conversation

bparrishMines
Copy link
Contributor

@bparrishMines bparrishMines commented Jan 11, 2023

This makes it so that the methods no longer throw and crash the app if the manager is closed. They now just ignore the call and log a warning. Similar to how WebView.destroy handles usage after it is called.

An alternative solution was to have if(instanceManager.isClosed()) return; added to every Flutter API method, but this seemed to easy to forget to add to new additions.

Fixes flutter/flutter#118199

Pre-launch Checklist

  • I read the Contributor Guide and followed the process outlined there for submitting PRs.
  • I read the Tree Hygiene wiki page, which explains my responsibilities.
  • I read and followed the relevant style guides and ran the auto-formatter. (Unlike the flutter/flutter repo, the flutter/plugins repo does use dart format.)
  • I signed the CLA.
  • The title of the PR starts with the name of the plugin surrounded by square brackets, e.g. [shared_preferences]
  • I listed at least one issue that this PR fixes in the description above.
  • I updated pubspec.yaml with an appropriate new version according to the pub versioning philosophy, or this PR is exempt from version changes.
  • I updated CHANGELOG.md to add a description of the change, following repository CHANGELOG style.
  • I updated/added relevant documentation (doc comments with ///).
  • I added new tests to check the change I am making, or this PR is test-exempt.
  • All existing and new tests are passing.

If you need help, consider asking for advice on the #hackers-new channel on Discord.

@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 (don't just cc him here, he won't see it! He's on Discord!).

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.

@github-actions github-actions bot added p: webview_flutter Edits files for a webview_flutter plugin platform-android labels Jan 11, 2023
@bparrishMines bparrishMines changed the title [webview_flutter_android] Dont throw errors on all instance manager methods [webview_flutter_android] Fixes crash when the Java InstanceManager was used after plugin was removed from engine. Jan 11, 2023
@bparrishMines bparrishMines changed the title [webview_flutter_android] Fixes crash when the Java InstanceManager was used after plugin was removed from engine. [webview_flutter_android] Fixes crash when the Java InstanceManager was used after plugin was removed from engine Jan 11, 2023
@bparrishMines bparrishMines marked this pull request as draft January 11, 2023 18:37
@bparrishMines bparrishMines marked this pull request as ready for review January 11, 2023 18:55
Copy link
Contributor

@stuartmorgan stuartmorgan left a comment

Choose a reason for hiding this comment

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

LGTM

@bparrishMines bparrishMines added autosubmit Merge PR when tree becomes green via auto submit App and removed autosubmit Merge PR when tree becomes green via auto submit App labels Jan 14, 2023
@bparrishMines bparrishMines added the autosubmit Merge PR when tree becomes green via auto submit App label Jan 14, 2023
@auto-submit auto-submit bot merged commit b751ff1 into flutter:main Jan 14, 2023
engine-flutter-autoroll added a commit to engine-flutter-autoroll/flutter that referenced this pull request Jan 16, 2023
…ceManager` was used after plugin was removed from engine (flutter/plugins#6943)
engine-flutter-autoroll added a commit to engine-flutter-autoroll/flutter that referenced this pull request Jan 16, 2023
…ceManager` was used after plugin was removed from engine (flutter/plugins#6943)
engine-flutter-autoroll added a commit to engine-flutter-autoroll/flutter that referenced this pull request Jan 17, 2023
…ceManager` was used after plugin was removed from engine (flutter/plugins#6943)
auto-submit bot pushed a commit to flutter/flutter that referenced this pull request Jan 17, 2023
* d607cd910 Roll Flutter from 0d91c03 to 2201698 (28 revisions) (flutter/plugins#6953)

* e2d174ca1 [tool] Check for search paths in Swift plugins (flutter/plugins#6954)

* f80aabf03 [shared_preferences] Revert recent iOS example changes (flutter/plugins#6955)

* f36fa6407 [android_webview_controller] Fixes bug where an `AndroidController` couldn't be reused (flutter/plugins#6910)

* b751ff166 [webview_flutter_android] Fixes crash when the Java `InstanceManager` was used after plugin was removed from engine (flutter/plugins#6943)

* 1efd51837 Roll Flutter from 2201698 to 68dd63d (9 revisions) (flutter/plugins#6956)

* eda98cddb Roll Flutter from 68dd63d to 1220245 (4 revisions) (flutter/plugins#6957)

* 4e5cf2d2d Roll Flutter from 1220245 to 8c2fdb8 (2 revisions) (flutter/plugins#6979)
gspencergoog pushed a commit to gspencergoog/flutter that referenced this pull request Jan 19, 2023
…#118624)

* d607cd910 Roll Flutter from 0d91c03 to 2201698 (28 revisions) (flutter/plugins#6953)

* e2d174ca1 [tool] Check for search paths in Swift plugins (flutter/plugins#6954)

* f80aabf03 [shared_preferences] Revert recent iOS example changes (flutter/plugins#6955)

* f36fa6407 [android_webview_controller] Fixes bug where an `AndroidController` couldn't be reused (flutter/plugins#6910)

* b751ff166 [webview_flutter_android] Fixes crash when the Java `InstanceManager` was used after plugin was removed from engine (flutter/plugins#6943)

* 1efd51837 Roll Flutter from 2201698 to 68dd63d (9 revisions) (flutter/plugins#6956)

* eda98cddb Roll Flutter from 68dd63d to 1220245 (4 revisions) (flutter/plugins#6957)

* 4e5cf2d2d Roll Flutter from 1220245 to 8c2fdb8 (2 revisions) (flutter/plugins#6979)
mauricioluz pushed a commit to mauricioluz/plugins that referenced this pull request Jan 26, 2023
… was used after plugin was removed from engine (flutter#6943)

* dont throw errors on all instance manager methods

* tests

* version bump

* change to logging a warning and ignore calls in other methods

* the

* documentation
@bparrishMines bparrishMines deleted the android_test_fix branch January 31, 2023 19:05
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
autosubmit Merge PR when tree becomes green via auto submit App p: webview_flutter Edits files for a webview_flutter plugin platform-android
Projects
None yet
Development

Successfully merging this pull request may close these issues.

[webview_flutter] Flaky Android failures
2 participants