From 493f3e8da5a112e1b33bfb3e9f51e7a2bd7edc7a Mon Sep 17 00:00:00 2001 From: Alex Dvornikov Date: Thu, 18 Jan 2018 15:21:01 -0800 Subject: [PATCH] Handle invalidation error in RCTObjcExecutor Differential Revision: D6748200 fbshipit-source-id: eb98782c2ba080273c1f027846984f5f4caddf26 --- React/CxxBridge/RCTObjcExecutor.mm | 5 ++++- 1 file changed, 4 insertions(+), 1 deletion(-) diff --git a/React/CxxBridge/RCTObjcExecutor.mm b/React/CxxBridge/RCTObjcExecutor.mm index 476bcff9b..94c071789 100644 --- a/React/CxxBridge/RCTObjcExecutor.mm +++ b/React/CxxBridge/RCTObjcExecutor.mm @@ -45,7 +45,10 @@ public: { m_jsCallback = ^(id json, NSError *error) { if (error) { - m_errorBlock(error); + // Do not use "m_errorBlock" here as the bridge might be in the middle + // of invalidation as a result of error handling and "this" can be + // already deallocated. + errorBlock(error); return; }