mirror of
https://github.com/facebook/react-native.git
synced 2025-11-01 09:14:26 +00:00
Guard against initializer interruptions in {Catalyst,Work,RNTester}TurboModuleManagerDelegate
Summary: Migrate over to [how we load so libraries in Fb4aTurboModuleManagerDelegate](https://fburl.com/diffusion/wu0mcr8o). ## Motivation When we migrated Twilight over to TurboModules, we used the CatalystTurboModuleManager as a template. This led to a production crash (T70918829) because we weren't loading so's this way. The fix: D24894071. I'm updating these two TMMDelegates so that people don't fall into the same trap when migrating other Standalone apps. Changelog: [Internal] Reviewed By: fkgozali Differential Revision: D24992931 fbshipit-source-id: 3ac3b8c30a67e24f79021f915abf5ae980d5b5d3
This commit is contained in:
committed by
Facebook GitHub Bot
parent
68a476103a
commit
27cf82074d
+14
-3
@@ -17,9 +17,7 @@ import java.util.List;
|
||||
|
||||
/** This class is responsible for creating all the TurboModules for the RNTester app. */
|
||||
public class RNTesterTurboModuleManagerDelegate extends ReactPackageTurboModuleManagerDelegate {
|
||||
static {
|
||||
SoLoader.loadLibrary("rntester_appmodules");
|
||||
}
|
||||
private static volatile boolean sIsSoLibraryLoaded;
|
||||
|
||||
protected native HybridData initHybrid();
|
||||
|
||||
@@ -30,4 +28,17 @@ public class RNTesterTurboModuleManagerDelegate extends ReactPackageTurboModuleM
|
||||
ReactApplicationContext context, List<ReactPackage> packages) {
|
||||
super(context, packages);
|
||||
}
|
||||
|
||||
@Override
|
||||
protected void maybeLoadOtherSoLibraries() {
|
||||
maybeLoadSoLibraries();
|
||||
}
|
||||
|
||||
// Prevents issues with initializer interruptions.
|
||||
private static synchronized void maybeLoadSoLibraries() {
|
||||
if (!sIsSoLibraryLoaded) {
|
||||
SoLoader.loadLibrary("rntester_appmodules");
|
||||
sIsSoLibraryLoaded = true;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user