Repository navigation
Avoid crash dismissing a Modal whose Activity was destroyed - #59233
Closed
Abbondanzo wants to merge 1 commit into
Closed
Abbondanzo wants to merge 1 commit into
Abbondanzo wants to merge 1 commit into
Conversation
Summary: `ReactModalHostView.dismiss()` skipped `Dialog.dismiss()` only when the dialog's Activity was finishing. When that Activity is destroyed without finishing (for example relaunched on a configuration change while a Modal is open), its windows are already removed, so `Dialog.dismiss()` throws `IllegalArgumentException: View=DecorView[...] not attached to window manager` and crashes the app during teardown. Also skip the dismiss when the Activity `isDestroyed`, and catch `IllegalArgumentException` around `Dialog.dismiss()`, matching the existing guard in `updateProperties()`. Changelog: [Android][Fixed] - Fix crash when dismissing a Modal whose Activity has already been destroyed Differential Revision: D125800172
|
@Abbondanzo has exported this pull request. If you are a Meta employee, you can view the originating Diff in D125800172. |
|
This pull request has been merged in 7439937. |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Summary:
ReactModalHostView.dismiss()skippedDialog.dismiss()only when the dialog's Activity was finishing. When that Activity is destroyed without finishing (for example relaunched on a configuration change while a Modal is open), its windows are already removed, soDialog.dismiss()throwsIllegalArgumentException: View=DecorView[...] not attached to window managerand crashes the app during teardown.Also skip the dismiss when the Activity
isDestroyed, and catchIllegalArgumentExceptionaroundDialog.dismiss(), matching the existing guard inupdateProperties().Changelog:
[Android][Fixed] - Fix crash when dismissing a Modal whose Activity has already been destroyed
Differential Revision: D125800172