mirror of
https://github.com/facebook/react-native.git
synced 2025-11-01 09:14:26 +00:00
Fabric: Using EventBeat::Owner to prevent a crash caused by issuing a bit for already deallocated Scheduler
Summary: The concept of `EventBeat::Owner` was introduced in D17128549, this diff implements some missing pieces of that. After the change, AsyncEventEmitter will check the existence of the "owner" (which is EventDispatcher) which guarantees that the rest of the pipeline is still alive (the validity of Runtime is guaranteed by RuntimeExecutor separately). The overall workflow is described in D17128549. Reviewed By: JoshuaGross Differential Revision: D17410738 fbshipit-source-id: a1ae8e09600546874cdc7c622b3d884b71c5b48d
This commit is contained in:
committed by
Facebook Github Bot
parent
e98a4b5eff
commit
46120bc38a
@@ -41,7 +41,12 @@ class AsyncEventBeat : public EventBeat {
|
||||
}
|
||||
|
||||
void induce() const override {
|
||||
runtimeExecutor_([=](jsi::Runtime &runtime) {
|
||||
runtimeExecutor_([this, ownerBox = ownerBox_](jsi::Runtime &runtime) {
|
||||
auto owner = ownerBox->owner.lock();
|
||||
if (!owner) {
|
||||
return;
|
||||
}
|
||||
|
||||
this->beat(runtime);
|
||||
});
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user