From cf2ef84b16775e0e0eb53410e7e6e4ac66d05d03 Mon Sep 17 00:00:00 2001 From: Kathy Gray Date: Fri, 15 Sep 2017 05:39:29 -0700 Subject: [PATCH] Move destroy threads in catalystinstance off the UI thread Reviewed By: cwdick Differential Revision: D5842135 fbshipit-source-id: e9c44c4129d4d10da8781798df121f5c676766f8 --- .../com/facebook/react/bridge/CatalystInstanceImpl.java | 7 +++++-- 1 file changed, 5 insertions(+), 2 deletions(-) diff --git a/ReactAndroid/src/main/java/com/facebook/react/bridge/CatalystInstanceImpl.java b/ReactAndroid/src/main/java/com/facebook/react/bridge/CatalystInstanceImpl.java index c372d16e3..cc254c83e 100644 --- a/ReactAndroid/src/main/java/com/facebook/react/bridge/CatalystInstanceImpl.java +++ b/ReactAndroid/src/main/java/com/facebook/react/bridge/CatalystInstanceImpl.java @@ -10,7 +10,9 @@ package com.facebook.react.bridge; import android.content.res.AssetManager; +import android.os.AsyncTask; import android.util.Log; + import com.facebook.common.logging.FLog; import com.facebook.infer.annotation.Assertions; import com.facebook.jni.HybridData; @@ -326,11 +328,12 @@ public class CatalystInstanceImpl implements CatalystInstance { listener.onTransitionToBridgeIdle(); } } - UiThreadUtil.runOnUiThread(new Runnable() { + AsyncTask.execute(new Runnable() { @Override public void run() { + // Kill non-UI threads from neutral third party + // potentially expensive, so don't run on UI thread mHybridData.resetNative(); - // Kill non-UI threads from UI thread. getReactQueueConfiguration().destroy(); Log.d(ReactConstants.TAG, "CatalystInstanceImpl.destroy() end"); }