Skip to content

Commit

Permalink
Guard against surface manager exceptions (#47910)
Browse files Browse the repository at this point in the history
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
  • Loading branch information
rozele authored and facebook-github-bot committed Nov 22, 2024
1 parent e344b49 commit a05d573
Showing 1 changed file with 3 additions and 3 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -625,10 +625,10 @@ private long measureMapBuffer(
* @return if theme data is available in the output parameters.
*/
public boolean getThemeData(int surfaceId, float[] defaultTextInputPadding) {
Context context =
mMountingManager.getSurfaceManagerEnforced(surfaceId, "getThemeData").getContext();
SurfaceMountingManager surfaceMountingManager = mMountingManager.getSurfaceManager(surfaceId);
Context context = surfaceMountingManager != null ? surfaceMountingManager.getContext() : null;
if (context == null) {
FLog.w(TAG, "\"themedReactContext\" is null when call \"getThemeData\"");
FLog.w(TAG, "Couldn't get context for surfaceId %d in getThemeData", surfaceId);
return false;
}

Expand Down

0 comments on commit a05d573

Please sign in to comment.