@@ -67,24 +67,25 @@ struct MultithreadingModule : jni::JavaClass<MultithreadingModule> {
6767 return std::make_shared<reanimated::AndroidErrorHandler>(scheduler_);
6868 };
6969 auto makeJsExecutor = []() -> std::unique_ptr<jsi::Runtime> {
70- __android_log_write (ANDROID_LOG_DEBUG , TAG, " Creating JSExecutorFactory.." );
70+ __android_log_write (ANDROID_LOG_INFO , TAG, " Creating JSExecutorFactory.." );
7171 try {
7272 // JNI needs to attach this thread because this function is being called from a different Thread
7373 ThreadScope scope;
7474
7575 std::shared_ptr<react::ExecutorDelegate> delegate = std::shared_ptr<react::ExecutorDelegate>();
7676 std::shared_ptr<react::MessageQueueThread> jsQueue = std::shared_ptr<react::MessageQueueThread>();
77+
7778 auto jsExecutorFactory = makeJSExecutorFactory ();
78- __android_log_write (ANDROID_LOG_DEBUG , TAG, " Creating JSExecutor.." );
79+ __android_log_write (ANDROID_LOG_INFO , TAG, " Creating JSExecutor.." );
7980 auto executor = jsExecutorFactory->createJSExecutor (delegate,
8081 jsQueue);
81- auto runtimePointer = static_cast <jsi::Runtime *>(executor->getJavaScriptContext ());
82- __android_log_write (ANDROID_LOG_DEBUG , TAG, " JSExecutor created!" );
82+ auto runtimePointer = static_cast <jsi::Runtime*>(executor->getJavaScriptContext ());
83+ __android_log_write (ANDROID_LOG_INFO , TAG, " JSExecutor created!" );
8384
84- // the returned value is now responsible for releasing the runtime .
85+ // I need to release the local shared_ptr because otherwise the returned jsi::Runtime will be destroyed immediately .
8586 auto _ = executor.release ();
86- return std::unique_ptr<jsi::Runtime>(runtimePointer);
8787
88+ return std::unique_ptr<jsi::Runtime>(runtimePointer);
8889 } catch (std::exception& exc) {
8990 // Fatal error - the runtime can't be created at all.
9091 __android_log_write (ANDROID_LOG_ERROR, TAG, " Failed to create JSExecutor!" );
0 commit comments