-
Notifications
You must be signed in to change notification settings - Fork 24.3k
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
Resolve Paper leak on Android #46896
Conversation
This pull request was exported from Phabricator. Differential Revision: D64054042 |
Summary: On Android Paper UIManager, when calling `ReactRootView.unmountReactApplication`, the ReactRootView tag is unset [here](https://github.com/facebook/react-native/blob/main/packages/react-native/ReactAndroid/src/main/java/com/facebook/react/ReactInstanceManager.java#L926), before the round trip unmount operation to JS makes it's way back to a `dropView` call on `NativeViewHierarchyManager`. In practice, this means that legacy architecture apps that unmount surfaces via `ReactRootView.unmountReactApplication` leak references to Views, and the "finalization" step (`onDropViewInstance`) is not universally called. This is an attempt to fix the issue by skipping the `clearReactRoot` step on Paper, instead waiting for the round trip `UIManager.removeRootView` call. ## Changelog [Android][Fixed] Fix issue where `onDropViewInstance` cleanup was not being handled after `ReactRootView.unmountReactApplication` Differential Revision: D64054042
5bfa425
to
17a0b63
Compare
This pull request was exported from Phabricator. Differential Revision: D64054042 |
Summary: On Android Paper UIManager, when calling `ReactRootView.unmountReactApplication`, the ReactRootView tag is unset [here](https://github.com/facebook/react-native/blob/main/packages/react-native/ReactAndroid/src/main/java/com/facebook/react/ReactInstanceManager.java#L926), before the round trip unmount operation to JS makes it's way back to a `dropView` call on `NativeViewHierarchyManager`. In practice, this means that legacy architecture apps that unmount surfaces via `ReactRootView.unmountReactApplication` leak references to Views, and the "finalization" step (`onDropViewInstance`) is not universally called. This is an attempt to fix the issue by skipping the `clearReactRoot` step on Paper, instead waiting for the round trip `UIManager.removeRootView` call. ## Changelog [Android][Fixed] Fix issue where `onDropViewInstance` cleanup was not being handled after `ReactRootView.unmountReactApplication` Differential Revision: D64054042
17a0b63
to
ecc15f9
Compare
This pull request was exported from Phabricator. Differential Revision: D64054042 |
cc @wschurman, since you authored #41678 Would this change cause any problems for |
This pull request has been merged in 0449630. |
This pull request was successfully merged by @rozele in 0449630 When will my fix make it into a release? | How to file a pick request? |
Summary:
On Android Paper UIManager, when calling
ReactRootView.unmountReactApplication
, the ReactRootView tag is unset here, before the round trip unmount operation to JS makes it's way back to adropView
call onNativeViewHierarchyManager
.In practice, this means that legacy architecture apps that unmount surfaces via
ReactRootView.unmountReactApplication
leak references to Views, and the "finalization" step (onDropViewInstance
) is not universally called.This fixes the issue on Paper by temporarily resetting the
ReactRootView
tag before callingdropView
.Changelog
[Android][Fixed] Fix issue where
onDropViewInstance
cleanup was not being handled afterReactRootView.unmountReactApplication
Differential Revision: D64054042