Skip to content

Commit a05d573

Browse files
rozelefacebook-github-bot
authored andcommitted
Guard against surface manager exceptions (#47910)
Summary: Pull Request resolved: #47910 It seems there could be a race where a commit is being processed on the JS thread after the surface has been removed from the mounting manager. Since we don't actually need to retrieve the default paddings in these cases, there's no reason we need an enforced read of the SurfaceMountingManager. ## Changelog [Internal] Reviewed By: javache Differential Revision: D66369969 fbshipit-source-id: 44ccdc9beafdbd0ac47457fb01c4114348c1a316
1 parent e344b49 commit a05d573

1 file changed

Lines changed: 3 additions & 3 deletions

File tree

packages/react-native/ReactAndroid/src/main/java/com/facebook/react/fabric/FabricUIManager.java

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -625,10 +625,10 @@ private long measureMapBuffer(
625625
* @return if theme data is available in the output parameters.
626626
*/
627627
public boolean getThemeData(int surfaceId, float[] defaultTextInputPadding) {
628-
Context context =
629-
mMountingManager.getSurfaceManagerEnforced(surfaceId, "getThemeData").getContext();
628+
SurfaceMountingManager surfaceMountingManager = mMountingManager.getSurfaceManager(surfaceId);
629+
Context context = surfaceMountingManager != null ? surfaceMountingManager.getContext() : null;
630630
if (context == null) {
631-
FLog.w(TAG, "\"themedReactContext\" is null when call \"getThemeData\"");
631+
FLog.w(TAG, "Couldn't get context for surfaceId %d in getThemeData", surfaceId);
632632
return false;
633633
}
634634

0 commit comments

Comments
 (0)