Files
react-native/packages
Pieter De Baets c16e993bb8 Fix SurfaceMountingManager leaking views from stopped surfaces (#37964)
Summary:
Pull Request resolved: https://github.com/facebook/react-native/pull/37964

When a Surface is stopped, we don't immediately destroy the SurfaceMountingManager but instead just tear down its internal state. This allows for better error handling (eg did this react tag ever exist, or is this non-existing tag).

The way we construct the set of tags post-deletion is flawed though: `mTagToViewState.keySet()` does not create a new Set with all the tags used, but instead uses the underlying HashMap to iterate over the keys as needed. This effectively keeps all the Views inside that deleted surface alive.

Changelog: [Android][Fixed] Surfaces in the new architecture no longer leak views once stopped

Reviewed By: sammy-SC, rshest

Differential Revision: D46840717

fbshipit-source-id: fad145e4dd21b216d1e64f5dc79900434cff1785
2023-06-20 14:20:29 -07:00
..