From 929c8e4baa30cc4815a6aef9fd5b9d45f47ca154 Mon Sep 17 00:00:00 2001 From: zhongwuzw Date: Mon, 24 Feb 2025 10:25:52 -0800 Subject: [PATCH] Fabric: disable React-Fabric stable_sort strict weak sort check in debug mode (#49422) Summary: Fixes assert crash in https://github.com/facebook/react-native/issues/46568#issuecomment-2653747732. We can temporarily downgrade _LIBCPP_HARDENING_MODE to _LIBCPP_HARDENING_MODE_EXTENSIVE, it disables strict weak ordering check in debug mode. Actually, when we sort animation mutations, we don't need it to satisfy strict weak ordering. https://libcxx.llvm.org/Hardening.html#id3 Another solution is we make sort satisfy it, but we don't have any key to compare when two mutation is the same mutation type but not the same parentTag. Maybe we can use pointer of muation to compare? ## Changelog: [IOS] [FIXED] - Fabric: disable React-Fabric stable_sort strict weak sort check in debug mode Pull Request resolved: https://github.com/facebook/react-native/pull/49422 Test Plan: Fixes https://github.com/facebook/react-native/issues/46568#issuecomment-2653747732. Reviewed By: sammy-SC Differential Revision: D69984937 Pulled By: cipolleschi fbshipit-source-id: 2a3d17970def513c4ba915068f25338169db82d6 --- .../ReactCommon/react/renderer/animations/utils.h | 8 ++------ 1 file changed, 2 insertions(+), 6 deletions(-) diff --git a/packages/react-native/ReactCommon/react/renderer/animations/utils.h b/packages/react-native/ReactCommon/react/renderer/animations/utils.h index 579c9c0ca82..e31923c2969 100644 --- a/packages/react-native/ReactCommon/react/renderer/animations/utils.h +++ b/packages/react-native/ReactCommon/react/renderer/animations/utils.h @@ -104,15 +104,11 @@ static inline bool shouldFirstComeBeforeSecondMutation( // must come first. if (lhs.type == ShadowViewMutation::Type::Remove && lhs.parentTag == rhs.parentTag) { - if (lhs.index > rhs.index) { - return true; - } else { - return false; - } + return lhs.index > rhs.index; } } - return false; + return &lhs < &rhs; } std::pair calculateAnimationProgress(