mirror of
https://github.com/facebook/react-native.git
synced 2026-11-18 20:19:07 +00:00
Fabric: Resetting *all* ShadowNode pointers in MountingCoordinator::revoke
Summary: With this diff (and maybe other coming in the future), we are enforcing a model where Fabric Core actively/architecturally prevents `jsi::Object` to overlive `UIManager`. That never was a promise that but I think it's achievable; it should help to eliminate the whole class of possible crashes (application layer still must ensure that Scheduler is deallocated before `jsi::Runtime`). Clearing all pointers to `ShadowNode`s in `MountingCoordinator` prevents from extending the lifetime of ShadowNodes stored inside revoked `MountingCoordinator` (the lifetime of `MountingCoordinator` is up to application layer). That should help prevent crashes (not all of them!) caused by `jsi::Object`s overliving `jsi::Runtime`. Changelog: [Internal] Reviewed By: sammy-SC Differential Revision: D18333708 fbshipit-source-id: 4391998b8f805563cfaff834fc56e85b98bc4d68
This commit is contained in:
1 parent
f7385ac1b8
commit
0eb7c7bc43
1 file changed
+5
@@ -52,6 +52,11 @@ void MountingCoordinator::push(ShadowTreeRevision &&revision) const {
|
||||
|
||||
void MountingCoordinator::revoke() const {
|
||||
std::lock_guard<std::mutex> lock(mutex_);
|
||||
// We have two goals here.
|
||||
// 1. We need to stop retaining `ShadowNode`s to not prolong their lifetime
|
||||
// to prevent them from overliving `ComponentDescriptor`s.
|
||||
// 2. A possible call to `pullTransaction()` should return empty optional.
|
||||
baseRevision_.rootShadowNode_.reset();
|
||||
lastRevision_.reset();
|
||||
}
|
||||
|
||||
|
||||
Reference in new issue
Block a user