mirror of
https://github.com/facebook/react-native.git
synced 2025-11-01 09:14:26 +00:00
Ignore exceptions when a Delete instruction is in the same BatchMountItem as its corresponding Create instruction during stopSurface
Summary: See title. Basically during stopSurface a single BatchMountInstruction can contain both the Create and Delete MountItem for a single view, which will cause *only* the deletion to be executed. There isn't really a way to prevent this and we're just trying to clean up as aggressively as possible, so we can safely ignore this. Changelog: [Internal] Reviewed By: mdvacca Differential Revision: D22779189 fbshipit-source-id: c44fd736835b04c5de776346ec3d34afa4860199
This commit is contained in:
committed by
Facebook GitHub Bot
parent
3bab643e5d
commit
07722cf746
+14
-1
@@ -8,6 +8,7 @@
|
||||
package com.facebook.react.fabric.mounting.mountitems;
|
||||
|
||||
import androidx.annotation.NonNull;
|
||||
import com.facebook.common.logging.FLog;
|
||||
import com.facebook.proguard.annotations.DoNotStrip;
|
||||
import com.facebook.react.bridge.ReactMarker;
|
||||
import com.facebook.react.bridge.ReactMarkerConstants;
|
||||
@@ -25,6 +26,7 @@ import com.facebook.systrace.Systrace;
|
||||
*/
|
||||
@DoNotStrip
|
||||
public class BatchMountItem implements MountItem {
|
||||
static final String TAG = "FabricBatchMountItem";
|
||||
|
||||
private final int mRootTag;
|
||||
@NonNull private final MountItem[] mMountItems;
|
||||
@@ -77,13 +79,24 @@ public class BatchMountItem implements MountItem {
|
||||
endMarkers();
|
||||
}
|
||||
|
||||
/**
|
||||
* In the case of teardown/stopSurface, we want to delete all views associated with a SurfaceID.
|
||||
* It can be the case that a single BatchMountItem contains both the create *and* delete
|
||||
* instruction for a view, so this needs to be failsafe.
|
||||
*
|
||||
* @param mountingManager
|
||||
*/
|
||||
public void executeDeletes(@NonNull MountingManager mountingManager) {
|
||||
beginMarkers("deleteViews");
|
||||
|
||||
for (int mountItemIndex = 0; mountItemIndex < mSize; mountItemIndex++) {
|
||||
MountItem mountItem = mMountItems[mountItemIndex];
|
||||
if (mountItem instanceof RemoveDeleteMultiMountItem) {
|
||||
((RemoveDeleteMultiMountItem) mountItem).executeDeletes(mountingManager, true);
|
||||
try {
|
||||
((RemoveDeleteMultiMountItem) mountItem).executeDeletes(mountingManager, true);
|
||||
} catch (RuntimeException e) {
|
||||
FLog.e(TAG, "Ignoring deletion exception", e);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
Reference in New Issue
Block a user