Skip to content

Commit

Permalink
Remove enableDrawMutationFix feature flag and ship it
Browse files Browse the repository at this point in the history
Summary:
This was added to prevent mutating the UI during draw or measure, and appears to have been effective. Keep the comments, ship the feature, remove flags.

Changelog: [Internal]

Reviewed By: mdvacca

Differential Revision: D25258409

fbshipit-source-id: 36ad8a03d1eb82bc9dcd769372c03f1ebe8b8da8
  • Loading branch information
JoshuaGross authored and facebook-github-bot committed Dec 2, 2020
1 parent 6864e5f commit 067d2ee
Show file tree
Hide file tree
Showing 2 changed files with 5 additions and 10 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -86,9 +86,6 @@ public class ReactFeatureFlags {
/** Disable customDrawOrder in ReactViewGroup under Fabric only. */
public static boolean disableCustomDrawOrderFabric = false;

/** Potential bugfix for crashes caused by mutating the view hierarchy during onDraw. */
public static boolean enableDrawMutationFix = true;

/** Use lock-free data structures for Fabric MountItems. */
public static boolean enableLockFreeMountInstructions = false;
}
Original file line number Diff line number Diff line change
Expand Up @@ -586,11 +586,11 @@ public void synchronouslyUpdateViewOnUIThread(

int commitNumber = mCurrentSynchronousCommitNumber++;

// We are on the UI thread so this would otherwise be safe to call, *BUT* we don't know
// where we are on the callstack. Why isn't this safe, and why do we have additional safeguards
// here?
// We are on the UI thread so it would otherwise be safe to call `tryDispatchMountItems` here to
// flush previously-queued mountitems, *BUT* we don't know where we are on the callstack.
// Why isn't it safe, and why do we have additional safeguards here?
//
// A tangible example where this will cause a crash:
// A tangible example where it would cause a crash, and did in the past:
// 1. There are queued "delete" mutations
// 2. We're called by this stack trace:
// FabricUIManager.synchronouslyUpdateViewOnUIThread(FabricUIManager.java:574)
Expand All @@ -607,9 +607,7 @@ public void synchronouslyUpdateViewOnUIThread(
// android.widget.ScrollView.overScrollBy(ScrollView.java:2040)
// android.widget.ScrollView.computeScroll(ScrollView.java:1481)
// android.view.View.updateDisplayListIfDirty(View.java:20466)
if (!ReactFeatureFlags.enableDrawMutationFix) {
tryDispatchMountItems();
}
// 3. A view is deleted while its parent is being drawn, causing a crash.

MountItem synchronousMountItem =
new MountItem() {
Expand Down

0 comments on commit 067d2ee

Please sign in to comment.