Permalink
Browse files

Prevent deadlock after bridge reload

Reviewed By: dcaspi

Differential Revision: D4551097

fbshipit-source-id: 33b43b2691d4e595d3c09c9a5b101ce458c4d6d7
  • Loading branch information...
javache authored and facebook-github-bot committed Feb 15, 2017
1 parent a2000d1 commit bbe0c45c19af26af9955112ced3fa0d7bd786500
Showing with 6 additions and 6 deletions.
  1. +6 −6 React/CxxBridge/RCTCxxBridge.mm
@@ -25,9 +25,6 @@
#import <React/RCTDevLoadingView.h>
#import <React/RCTDevMenu.h>
#import <React/RCTDisplayLink.h>
#ifdef WITH_FBSYSTRACE
#import <React/RCTFBSystrace.h>
#endif
#import <React/RCTJavaScriptLoader.h>
#import <React/RCTLog.h>
#import <React/RCTModuleData.h>
@@ -47,6 +44,10 @@
#import "RCTNativeModule.h"
#import "RCTObjcExecutor.h"
#ifdef WITH_FBSYSTRACE
#import <React/RCTFBSystrace.h>
#endif
#define RCTAssertJSThread() \
RCTAssert(self.executorClass || self->_jsThread == [NSThread currentThread], \
@"This method must be called on JS thread")
@@ -578,16 +579,15 @@ - (BOOL)moduleIsInitialized:(Class)moduleClass
for (RCTModuleData *moduleData in _moduleDataByID) {
// TODO mhorowitz #10487027: unwrap C++ modules and register them directly.
if ([moduleData.moduleClass isSubclassOfClass:[RCTCxxModule class]]) {
RCTCxxModule *cxxInstance = moduleData.instance;
// If a module does not support automatic instantiation, and
// wasn't provided as an extra module, it may not have an
// instance. If so, skip it.
if (!cxxInstance) {
if (![moduleData hasInstance]) {
continue;
}
modules.emplace_back(
new QueueNativeModule(self, std::make_unique<CxxNativeModule>(
_reactInstance, [cxxInstance move])));
_reactInstance, [(RCTCxxModule *)(moduleData.instance) move])));
} else {
modules.emplace_back(new RCTNativeModule(self, moduleData));
}

0 comments on commit bbe0c45

Please sign in to comment.