Skip to content

Commit

Permalink
Fix race condition when reporting mounting transactions for deallocat…
Browse files Browse the repository at this point in the history
…ed surfaces

Summary:
Changelog: [internal]

This code is gated anyway so there's no harm in production.

Differential Revision: D64322331
  • Loading branch information
rubennorte authored and facebook-github-bot committed Oct 14, 2024
1 parent 60bc3c5 commit 5b37072
Show file tree
Hide file tree
Showing 3 changed files with 6 additions and 7 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -11,7 +11,6 @@ package com.facebook.react.defaults

import com.facebook.react.common.annotations.VisibleForTesting
import com.facebook.react.internal.featureflags.ReactNativeFeatureFlags
import com.facebook.react.internal.featureflags.ReactNativeNewArchitectureFeatureFlagsDefaults

/**
* A utility class that serves as an entry point for users setup the New Architecture.
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -5,18 +5,15 @@
* LICENSE file in the root directory of this source tree.
*/

@file:Suppress("DEPRECATION") // We want to use ReactFeatureFlags here specifically
package com.facebook.react.defaults

package com.facebook.react.internal.featureflags
import com.facebook.react.internal.featureflags.ReactNativeFeatureFlagsDefaults

/**
* This class initializes default values for ReactNativeFeatureFlags when the New architecture is
* enabled. This class is meant to be overrode only by internal apps migrating to the new
* architecture.
*
* NOTE: Be aware that as a side effect this class also modifies static fields in {@link
* com.facebook.react.config.ReactFeatureFlags} when newArchitectureEnabled is true.
*
* When the new architecture is enabled, we want to set the default values of the flags for Fabric,
* TurboModules and Bridgeless as enabled by default.
*/
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -121,7 +121,10 @@ void FabricUIManagerBinding::reportMount(SurfaceId surfaceId) {
}
}
if (surfaceHandler != nullptr) {
surfaceHandler->getMountingCoordinator()->didPerformAsyncTransactions();
auto mountingCoordinator = surfaceHandler->getMountingCoordinator();
if (mountingCoordinator != nullptr) {
mountingCoordinator->didPerformAsyncTransactions();
}
}
} else {
LOG(ERROR) << "FabricUIManagerBinding::reportMount: Surface with id "
Expand Down

0 comments on commit 5b37072

Please sign in to comment.