Сбой приложения в facebook :: jsc :: JSCRuntime :: JSCRuntime (), строка 285 (реакция-нативная) - PullRequest
1 голос
/ 08 октября 2019

Приложение выходит из строя. Не в состоянии воспроизвести то же самое. Stacktrace кода выглядит следующим образом:

-;facebook::jsc::JSCRuntime::JSCRuntime();JSCRuntime.cpp;285
-;facebook::jsc::makeJSCRuntime();memory;3078
-;facebook::react::JSCExecutorFactory::createJSExecutor(std::__1::shared_ptr, std::__1::shared_ptr);JSCExecutorFactory.mm;20
-;facebook::react::NativeToJsBridge::NativeToJsBridge(facebook::react::JSExecutorFactory*, std::__1::shared_ptr, std::__1::shared_ptr, std::__1::shared_ptr);NativeToJsBridge.cpp;93
-;std::__1::__function::__func<facebook::react::Instance::initializeBridge(std::__1::unique_ptr >, std::__1::shared_ptr, std::__1::shared_ptr, std::__1::shared_ptr)::$_0, std::__1::allocator<facebook::react::Instance::initializeBridge(std::__1::unique_ptr >, std::__1::shared_ptr, std::__1::shared_ptr, std::__1::shared_ptr)::$_0>, void ()>::operator()();memory;3078
-;facebook::react::tryAndReturnError(std::__1::function const&);RCTCxxUtils.mm;72
-;facebook::react::RCTMessageThread::tryFunc(std::__1::function const&);RCTMessageThread.mm;59
-;facebook::react::RCTMessageThread::runOnQueueSync(std::__1::function&&);RCTMessageThread.mm;81
-;facebook::react::Instance::initializeBridge(std::__1::unique_ptr >, std::__1::shared_ptr, std::__1::shared_ptr, std::__1::shared_ptr);Instance.cpp;46
RCTCxxBridge;_initializeBridgeLocked:;RCTCxxBridge.mm;569
RCTCxxBridge;_initializeBridge:;RCTCxxBridge.mm;550
RCTCxxBridge;start;RCTCxxBridge.mm;344
-;facebook::react::tryAndReturnError(std::__1::function const&);RCTCxxUtils.mm;72
RCTCxxBridge;_tryAndHandleError:;RCTCxxBridge.mm;257
RCTCxxBridge;runRunLoop;RCTCxxBridge.mm;249

Попытка сделать некоторые переменные нулевыми, но не работает.

+ (void)runRunLoop
{
  @autoreleasepool {
    RCT_PROFILE_BEGIN_EVENT(RCTProfileTagAlways, @"-[RCTCxxBridge runJSRunLoop] setup", nil);

    // copy thread name to pthread name
    pthread_setname_np([NSThread currentThread].name.UTF8String);

    // Set up a dummy runloop source to avoid spinning
    CFRunLoopSourceContext noSpinCtx = {0, NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL};
    CFRunLoopSourceRef noSpinSource = CFRunLoopSourceCreate(NULL, 0, &noSpinCtx);
    CFRunLoopAddSource(CFRunLoopGetCurrent(), noSpinSource, kCFRunLoopDefaultMode);
    CFRelease(noSpinSource);

    RCT_PROFILE_END_EVENT(RCTProfileTagAlways, @"");

    // run the run loop
    while (kCFRunLoopRunStopped != CFRunLoopRunInMode(kCFRunLoopDefaultMode, ((NSDate *)[NSDate distantFuture]).timeIntervalSinceReferenceDate, NO)) {
      RCTAssert(NO, @"not reached assertion"); // runloop spun. that's bad.
    }
  }
}

- (void)_tryAndHandleError:(dispatch_block_t)block
{
  NSError *error = tryAndReturnError(block);
  if (error) {
    [self handleError:error];
  }
}

Весь код можно найти здесь. https://github.com/facebook/react-native/blob/master/React/CxxBridge/RCTCxxBridge.mm

Это для создания моста реакции-нативного для нативного приложения. Пожалуйста, прокомментируйте, если вам нужна дополнительная информация.

...