Skip to content

Commit

Permalink
Guard against surface manager exceptions
Browse files Browse the repository at this point in the history
Summary:
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]

Differential Revision: D66369969
  • Loading branch information
rozele authored and facebook-github-bot committed Nov 22, 2024
1 parent 0b22b95 commit 4c04106
Showing 1 changed file with 2 additions and 2 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -625,8 +625,8 @@ 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\"");
return false;
Expand Down

0 comments on commit 4c04106

Please sign in to comment.