-
Notifications
You must be signed in to change notification settings - Fork 6k
Fix crash when removeViewImmediate invoked from platform view #6266
Fix crash when removeViewImmediate invoked from platform view #6266
Conversation
|
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 (e.g. What to do if you already signed the CLAIndividual signers
Corporate signers
|
1 similar comment
|
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 (e.g. What to do if you already signed the CLAIndividual signers
Corporate signers
|
|
I signed it! |
|
CLAs look good, thanks! |
1 similar comment
|
CLAs look good, thanks! |
|
Can we get some context around this issue? What is the use-case in question? |
mklim
left a comment
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Thanks for the contribution @wsxyeah!
Can we get some context around this issue? What is the use-case in question?
So my understanding is that SingleViewPresentation needs to override and intercept all of the WindowManager methods that involve altering the WM's view hierarchy. It manually attaches the views in question to SingleViewPresentation#mFakeWindowRootView to avoid crashing at certain edge cases. Some comments, original PR.
It looks like when those changes were originally added they didn't cover removeViewImmediate, so that method call still falls back to WindowManager itself. That's triggering an error now since the base class isn't tracking the hierarchy anymore: View=android.widget.PopupWindow$PopupDecorView{a54e7dd V.E...... R....... 288,528-393,633} not attached to window manager
/cc @amirh in case he can provide an extra insight to the original issue.
| return; | ||
| } | ||
| View view = (View) args[0]; | ||
| mFakeWindowRootView.removeView(view); |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
This doesn't exactly emulate what the base removeViewImmediate does.
Special variation of ViewManager.removeView(View) that immediately invokes the given view hierarchy's View.onDetachedFromWindow() methods before returning.
Should this be calling onDetachedFromWindow()?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I just looked up the implementation of ViewGroup.removeView().
Iff view.getAnimation() != null || (mTransitioningViews != null && mTransitioningViews.contains(view)), the child's onDetachedFromWindow will not be called.
Since there's not transition set on mFakeWindowRootView, we can just consider call child's clearAnimation() to skip this case. That is to say, onDetachedFromWindow will always be called immediately.
shell/platform/android/io/flutter/plugin/platform/SingleViewPresentation.java
Show resolved
Hide resolved
I wrapped a native |
664a6b9 to
1d9c291
Compare
amirh
left a comment
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
This is great! thank you for the fix.
I wonder if this also fixes flutter/flutter#21239
LGTM with a small nit.
| return; | ||
| } | ||
| View view = (View) args[0]; | ||
| view.clearAnimation(); |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Do you know if clearAnimation is triggered when calling WindowManager.removeViewImmediate, and WindowManager.removeView we should probably be consistent with whatever WindowManager is doing.
Doesn't have to happen in this PR, feel free to just leave a:
// TODO(amirh): Make sure that the clearAnimation call in removeViewImmediate and removeView is consistent with WindowManager.
And I'll take a look when I'm bacl.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Sorry for the late reply.
As far as I know, WindowManager.removeViewImmediate will not trigger View.clearAnimation, but mCurrentAnimation of the view will be assigned to null when it's detached from window.
Clear animation is a workaround for remove view immediately, otherwise the view will not got removed synchronously.
|
LGTM as long as the comment from amirh@ is addressed. Thanks again! |
|
@mklim Can we commit this? Clearing the PR queue. |
flutter/engine@08272ee...26f437f git log 08272ee..26f437f --no-merges --oneline 26f437f Fix crash when removeViewImmediate invoked from platform view (flutter/engine#6266) aed6b8c Roll Dart to ac6d4f7e653deba11d4836768376537893a9e9d6. (flutter/engine#6549) 3ba6270 Roll src/third_party/skia 921ec976556c..4b7b2ceb4ad9 (14 commits) (flutter/engine#6550) The AutoRoll server is located here: https://autoroll.skia.org/r/flutter-engine-flutter-autoroll Documentation for the AutoRoller is here: https://skia.googlesource.com/buildbot/+/master/autoroll/README.md If the roll is causing failures, please contact the current sheriff, who should be CC'd on the roll, and stop the roller if necessary.
flutter/engine@08272ee...2cd79d1 git log 08272ee..2cd79d1 --no-merges --oneline 2cd79d1 Roll src/third_party/skia 4b7b2ceb4ad9..b3067e8e1b6e (1 commits) (flutter/engine#6551) 62cd86c Advertise iOS Observatory port over mDNS/Bonjour (flutter/engine#6533) 26f437f Fix crash when removeViewImmediate invoked from platform view (flutter/engine#6266) aed6b8c Roll Dart to ac6d4f7e653deba11d4836768376537893a9e9d6. (flutter/engine#6549) 3ba6270 Roll src/third_party/skia 921ec976556c..4b7b2ceb4ad9 (14 commits) (flutter/engine#6550) The AutoRoll server is located here: https://autoroll.skia.org/r/flutter-engine-flutter-autoroll Documentation for the AutoRoller is here: https://skia.googlesource.com/buildbot/+/master/autoroll/README.md If the roll is causing failures, please contact the current sheriff, who should be CC'd on the roll, and stop the roller if necessary.
flutter/engine@08272ee...126e61d git log 08272ee..126e61d --no-merges --oneline 126e61d Roll src/third_party/skia b3067e8e1b6e..198b87e5be20 (2 commits) (flutter/engine#6553) 2cd79d1 Roll src/third_party/skia 4b7b2ceb4ad9..b3067e8e1b6e (1 commits) (flutter/engine#6551) 62cd86c Advertise iOS Observatory port over mDNS/Bonjour (flutter/engine#6533) 26f437f Fix crash when removeViewImmediate invoked from platform view (flutter/engine#6266) aed6b8c Roll Dart to ac6d4f7e653deba11d4836768376537893a9e9d6. (flutter/engine#6549) 3ba6270 Roll src/third_party/skia 921ec976556c..4b7b2ceb4ad9 (14 commits) (flutter/engine#6550) The AutoRoll server is located here: https://autoroll.skia.org/r/flutter-engine-flutter-autoroll Documentation for the AutoRoller is here: https://skia.googlesource.com/buildbot/+/master/autoroll/README.md If the roll is causing failures, please contact the current sheriff, who should be CC'd on the roll, and stop the roller if necessary.
flutter/engine@08272ee...2dbbb2a git log 08272ee..2dbbb2a --no-merges --oneline 2dbbb2a Roll src/third_party/skia 198b87e5be20..a583a06f831e (5 commits) (flutter/engine#6554) 126e61d Roll src/third_party/skia b3067e8e1b6e..198b87e5be20 (2 commits) (flutter/engine#6553) 2cd79d1 Roll src/third_party/skia 4b7b2ceb4ad9..b3067e8e1b6e (1 commits) (flutter/engine#6551) 62cd86c Advertise iOS Observatory port over mDNS/Bonjour (flutter/engine#6533) 26f437f Fix crash when removeViewImmediate invoked from platform view (flutter/engine#6266) aed6b8c Roll Dart to ac6d4f7e653deba11d4836768376537893a9e9d6. (flutter/engine#6549) 3ba6270 Roll src/third_party/skia 921ec976556c..4b7b2ceb4ad9 (14 commits) (flutter/engine#6550) The AutoRoll server is located here: https://autoroll.skia.org/r/flutter-engine-flutter-autoroll Documentation for the AutoRoller is here: https://skia.googlesource.com/buildbot/+/master/autoroll/README.md If the roll is causing failures, please contact the current sheriff, who should be CC'd on the roll, and stop the roller if necessary.
flutter/engine@08272ee...fc376dd git log 08272ee..fc376dd --no-merges --oneline fc376dd Roll src/third_party/skia a583a06f831e..1349ec4de78c (1 commits) (flutter/engine#6555) 2dbbb2a Roll src/third_party/skia 198b87e5be20..a583a06f831e (5 commits) (flutter/engine#6554) 126e61d Roll src/third_party/skia b3067e8e1b6e..198b87e5be20 (2 commits) (flutter/engine#6553) 2cd79d1 Roll src/third_party/skia 4b7b2ceb4ad9..b3067e8e1b6e (1 commits) (flutter/engine#6551) 62cd86c Advertise iOS Observatory port over mDNS/Bonjour (flutter/engine#6533) 26f437f Fix crash when removeViewImmediate invoked from platform view (flutter/engine#6266) aed6b8c Roll Dart to ac6d4f7e653deba11d4836768376537893a9e9d6. (flutter/engine#6549) 3ba6270 Roll src/third_party/skia 921ec976556c..4b7b2ceb4ad9 (14 commits) (flutter/engine#6550) The AutoRoll server is located here: https://autoroll.skia.org/r/flutter-engine-flutter-autoroll Documentation for the AutoRoller is here: https://skia.googlesource.com/buildbot/+/master/autoroll/README.md If the roll is causing failures, please contact the current sheriff, who should be CC'd on the roll, and stop the roller if necessary.
flutter/engine@08272ee...215c146 git log 08272ee..215c146 --no-merges --oneline 215c146 Roll src/third_party/skia 1349ec4de78c..3d99b1e347be (3 commits) (flutter/engine#6556) fc376dd Roll src/third_party/skia a583a06f831e..1349ec4de78c (1 commits) (flutter/engine#6555) 2dbbb2a Roll src/third_party/skia 198b87e5be20..a583a06f831e (5 commits) (flutter/engine#6554) 126e61d Roll src/third_party/skia b3067e8e1b6e..198b87e5be20 (2 commits) (flutter/engine#6553) 2cd79d1 Roll src/third_party/skia 4b7b2ceb4ad9..b3067e8e1b6e (1 commits) (flutter/engine#6551) 62cd86c Advertise iOS Observatory port over mDNS/Bonjour (flutter/engine#6533) 26f437f Fix crash when removeViewImmediate invoked from platform view (flutter/engine#6266) aed6b8c Roll Dart to ac6d4f7e653deba11d4836768376537893a9e9d6. (flutter/engine#6549) 3ba6270 Roll src/third_party/skia 921ec976556c..4b7b2ceb4ad9 (14 commits) (flutter/engine#6550) The AutoRoll server is located here: https://autoroll.skia.org/r/flutter-engine-flutter-autoroll Documentation for the AutoRoller is here: https://skia.googlesource.com/buildbot/+/master/autoroll/README.md If the roll is causing failures, please contact the current sheriff, who should be CC'd on the roll, and stop the roller if necessary.
flutter/engine@08272ee...df5f420 git log 08272ee..df5f420 --no-merges --oneline df5f420 Roll src/third_party/skia 3d99b1e347be..c9092eb46754 (10 commits) (flutter/engine#6559) 215c146 Roll src/third_party/skia 1349ec4de78c..3d99b1e347be (3 commits) (flutter/engine#6556) fc376dd Roll src/third_party/skia a583a06f831e..1349ec4de78c (1 commits) (flutter/engine#6555) 2dbbb2a Roll src/third_party/skia 198b87e5be20..a583a06f831e (5 commits) (flutter/engine#6554) 126e61d Roll src/third_party/skia b3067e8e1b6e..198b87e5be20 (2 commits) (flutter/engine#6553) 2cd79d1 Roll src/third_party/skia 4b7b2ceb4ad9..b3067e8e1b6e (1 commits) (flutter/engine#6551) 62cd86c Advertise iOS Observatory port over mDNS/Bonjour (flutter/engine#6533) 26f437f Fix crash when removeViewImmediate invoked from platform view (flutter/engine#6266) aed6b8c Roll Dart to ac6d4f7e653deba11d4836768376537893a9e9d6. (flutter/engine#6549) 3ba6270 Roll src/third_party/skia 921ec976556c..4b7b2ceb4ad9 (14 commits) (flutter/engine#6550) The AutoRoll server is located here: https://autoroll.skia.org/r/flutter-engine-flutter-autoroll Documentation for the AutoRoller is here: https://skia.googlesource.com/buildbot/+/master/autoroll/README.md If the roll is causing failures, please contact the current sheriff, who should be CC'd on the roll, and stop the roller if necessary.
flutter/engine@08272ee...04c860f git log 08272ee..04c860f --no-merges --oneline 04c860f Revert "Roll Dart to ac6d4f7e653deba11d4836768376537893a9e9d6. (flutter#6549)" (flutter/engine#6568) ef2ea12 Roll src/third_party/skia 5b90b84085cf..cb65ce7f77c9 (8 commits) (flutter/engine#6567) 065246e Roll src/third_party/skia 483536c242f3..5b90b84085cf (3 commits) (flutter/engine#6566) b0008ca Roll src/third_party/skia 583161c09a3b..483536c242f3 (2 commits) (flutter/engine#6565) e22da7c Roll src/third_party/skia 0a8faf3f557d..583161c09a3b (1 commits) (flutter/engine#6564) 915f5e0 Roll src/third_party/skia f831b64ed40e..0a8faf3f557d (5 commits) (flutter/engine#6563) ad0fbd5 Roll src/third_party/skia c9092eb46754..f831b64ed40e (14 commits) (flutter/engine#6561) 6697d9d Update @animation dartdoc directives to current api (flutter/engine#6552) 10f9cab Ensure that the platform view is created and destroyed when running the shell unittests. (flutter/engine#6560) df5f420 Roll src/third_party/skia 3d99b1e347be..c9092eb46754 (10 commits) (flutter/engine#6559) 215c146 Roll src/third_party/skia 1349ec4de78c..3d99b1e347be (3 commits) (flutter/engine#6556) fc376dd Roll src/third_party/skia a583a06f831e..1349ec4de78c (1 commits) (flutter/engine#6555) 2dbbb2a Roll src/third_party/skia 198b87e5be20..a583a06f831e (5 commits) (flutter/engine#6554) 126e61d Roll src/third_party/skia b3067e8e1b6e..198b87e5be20 (2 commits) (flutter/engine#6553) 2cd79d1 Roll src/third_party/skia 4b7b2ceb4ad9..b3067e8e1b6e (1 commits) (flutter/engine#6551) 62cd86c Advertise iOS Observatory port over mDNS/Bonjour (flutter/engine#6533) 26f437f Fix crash when removeViewImmediate invoked from platform view (flutter/engine#6266) aed6b8c Roll Dart to ac6d4f7e653deba11d4836768376537893a9e9d6. (flutter/engine#6549) 3ba6270 Roll src/third_party/skia 921ec976556c..4b7b2ceb4ad9 (14 commits) (flutter/engine#6550) The AutoRoll server is located here: https://autoroll.skia.org/r/flutter-engine-flutter-autoroll Documentation for the AutoRoller is here: https://skia.googlesource.com/buildbot/+/master/autoroll/README.md If the roll is causing failures, please contact the current sheriff, who should be CC'd on the roll, and stop the roller if necessary.
flutter/engine@08272ee...04c860f git log 08272ee..04c860f --no-merges --oneline 04c860f Revert "Roll Dart to ac6d4f7e653deba11d4836768376537893a9e9d6. (#6549)" (flutter/engine#6568) ef2ea12 Roll src/third_party/skia 5b90b84085cf..cb65ce7f77c9 (8 commits) (flutter/engine#6567) 065246e Roll src/third_party/skia 483536c242f3..5b90b84085cf (3 commits) (flutter/engine#6566) b0008ca Roll src/third_party/skia 583161c09a3b..483536c242f3 (2 commits) (flutter/engine#6565) e22da7c Roll src/third_party/skia 0a8faf3f557d..583161c09a3b (1 commits) (flutter/engine#6564) 915f5e0 Roll src/third_party/skia f831b64ed40e..0a8faf3f557d (5 commits) (flutter/engine#6563) ad0fbd5 Roll src/third_party/skia c9092eb46754..f831b64ed40e (14 commits) (flutter/engine#6561) 6697d9d Update @animation dartdoc directives to current api (flutter/engine#6552) 10f9cab Ensure that the platform view is created and destroyed when running the shell unittests. (flutter/engine#6560) df5f420 Roll src/third_party/skia 3d99b1e347be..c9092eb46754 (10 commits) (flutter/engine#6559) 215c146 Roll src/third_party/skia 1349ec4de78c..3d99b1e347be (3 commits) (flutter/engine#6556) fc376dd Roll src/third_party/skia a583a06f831e..1349ec4de78c (1 commits) (flutter/engine#6555) 2dbbb2a Roll src/third_party/skia 198b87e5be20..a583a06f831e (5 commits) (flutter/engine#6554) 126e61d Roll src/third_party/skia b3067e8e1b6e..198b87e5be20 (2 commits) (flutter/engine#6553) 2cd79d1 Roll src/third_party/skia 4b7b2ceb4ad9..b3067e8e1b6e (1 commits) (flutter/engine#6551) 62cd86c Advertise iOS Observatory port over mDNS/Bonjour (flutter/engine#6533) 26f437f Fix crash when removeViewImmediate invoked from platform view (flutter/engine#6266) aed6b8c Roll Dart to ac6d4f7e653deba11d4836768376537893a9e9d6. (flutter/engine#6549) 3ba6270 Roll src/third_party/skia 921ec976556c..4b7b2ceb4ad9 (14 commits) (flutter/engine#6550) The AutoRoll server is located here: https://autoroll.skia.org/r/flutter-engine-flutter-autoroll Documentation for the AutoRoller is here: https://skia.googlesource.com/buildbot/+/master/autoroll/README.md If the roll is causing failures, please contact the current sheriff, who should be CC'd on the roll, and stop the roller if necessary.
Since
removeViewImmediatemethod isn't handled byWindowManagerHandler,the real
WindowManager'sremoveViewImmediatewill be invoked, which caused the crash.Here is the crash stack trace: