mirror of
https://github.com/facebook/react-native.git
synced 2026-11-18 20:19:07 +00:00
A corner case check in Instance::handleMemoryPressure
Summary: At some early stages of Instance initialization, it does not have a `nativeToJsBridge_`. At the same time, `handleMemoryPressure` can be called at any point in time, so we should check the pointer for not being null before calling on it. Changelog: [Internal] Fabric-specific internal change. Reviewed By: JoshuaGross, mdvacca Differential Revision: D21798522 fbshipit-source-id: 6384da88784cceb493cf9810408cbb47777d3f4b
This commit is contained in:
1 parent
b99bdaa218
commit
9d6d39de86
1 file changed
+5
-1
@@ -222,7 +222,11 @@ ModuleRegistry &Instance::getModuleRegistry() {
|
||||
}
|
||||
|
||||
void Instance::handleMemoryPressure(int pressureLevel) {
|
||||
nativeToJsBridge_->handleMemoryPressure(pressureLevel);
|
||||
if (nativeToJsBridge_) {
|
||||
// This class resets `nativeToJsBridge_` only in the destructor,
|
||||
// hence a race is not possible there.
|
||||
nativeToJsBridge_->handleMemoryPressure(pressureLevel);
|
||||
}
|
||||
}
|
||||
|
||||
std::shared_ptr<CallInvoker> Instance::getJSCallInvoker() {
|
||||
|
||||
Reference in new issue
Block a user