From 67209e6396516358ec47d68eeb14b84f8d0d7991 Mon Sep 17 00:00:00 2001 From: Marc Horowitz Date: Fri, 20 Nov 2015 09:09:36 -0800 Subject: [PATCH] If fbsystrace is running when catalyst starts, it asserts Summary: registering with systrace checks if the bridge is initialized, which it's not yet in the ctor. Defer registration until after the bridge is created, and only unregister in that case. public Reviewed By: astreet, dreiss Differential Revision: D2651244 fb-gh-sync-id: 8da1108e9d15fddde48d06f4ed61ee0f787016ad --- .../java/com/facebook/react/bridge/CatalystInstance.java | 5 +++-- 1 file changed, 3 insertions(+), 2 deletions(-) diff --git a/ReactAndroid/src/main/java/com/facebook/react/bridge/CatalystInstance.java b/ReactAndroid/src/main/java/com/facebook/react/bridge/CatalystInstance.java index c96ddb8e4..f8d7bff45 100644 --- a/ReactAndroid/src/main/java/com/facebook/react/bridge/CatalystInstance.java +++ b/ReactAndroid/src/main/java/com/facebook/react/bridge/CatalystInstance.java @@ -82,7 +82,6 @@ public class CatalystInstance { mJSBundleLoader = jsBundleLoader; mNativeModuleCallExceptionHandler = nativeModuleCallExceptionHandler; mTraceListener = new JSProfilerTraceListener(); - Systrace.registerListener(mTraceListener); final CountDownLatch initLatch = new CountDownLatch(1); mCatalystQueueConfiguration.getJSQueueThread().runOnQueue( @@ -116,6 +115,8 @@ public class CatalystInstance { mBridge.setGlobalVariable( "__fbBatchedBridgeConfig", buildModulesConfigJSONProperty(mJavaRegistry, jsModulesConfig)); + + Systrace.registerListener(mTraceListener); } public void runJSBundle() { @@ -239,7 +240,7 @@ public class CatalystInstance { } } - if (mTraceListener != null) { + if (mBridge != null) { Systrace.unregisterListener(mTraceListener); }