mirror of
https://github.com/facebook/react-native.git
synced 2025-11-01 09:14:26 +00:00
Change tearDownReactContext ordering to prevent null assertion
Summary: In `tearDownReactContext`, `reactContext.destroy()` sets `mCatalystInstance` to null. We cannot call `reactContext.getCatalystInstance()` after that without hitting an assertion. Change ordering so that doesn't happen in reload or teardown. Changelog: [Internal] Reviewed By: makovkastar Differential Revision: D18041279 fbshipit-source-id: 22658dc506b76cf58aee1008841abacfe9410c9d
This commit is contained in:
committed by
Facebook Github Bot
parent
585dfff22b
commit
cd12f256e9
@@ -1126,9 +1126,12 @@ public class ReactInstanceManager {
|
||||
}
|
||||
}
|
||||
|
||||
// Remove memory pressure listener before tearing down react context
|
||||
// We cannot access the CatalystInstance after destroying the ReactContext.
|
||||
mMemoryPressureRouter.removeMemoryPressureListener(reactContext.getCatalystInstance());
|
||||
|
||||
reactContext.destroy();
|
||||
mDevSupportManager.onReactInstanceDestroyed(reactContext);
|
||||
mMemoryPressureRouter.removeMemoryPressureListener(reactContext.getCatalystInstance());
|
||||
}
|
||||
|
||||
/** @return instance of {@link ReactContext} configured a {@link CatalystInstance} set */
|
||||
|
||||
Reference in New Issue
Block a user