iOS 26: Fabric index corruption + dangling pointer-interaction registration cause use-after-free crashes
まだ誰も着手していません。
評価
- 難易度
- 4/5
- 見積もり時間
- 3〜5日
- 初心者へのやさしさ
- 72/100
- issue の種類
- バグ
- 明瞭さ
- 明確に書かれている
- 活発さ
- 活発
- 技術スタック
- cpp, ios, objective-c, react-native, swift
- 領域
- mobile-dev
調査の方向性
ios/LiquidGlassView.mm と ios/LiquidGlassView.swift を読み、Fabric の子のマウントと recycle/deallocation パスに注目してください。interactive glass views と navigation churn を使って、説明されている iOS 26 のストレスループを実行してください。両方の報告済み crash signature が引き続き発生せず、fallback class が古い SDK ブランチでも引き続きコンパイルできれば完了です。
索引モデルが issue の本文から書いたものです。
説明
Summary
On iOS 26, apps using LiquidGlassView (especially with interactive) crash sporadically with memory-corruption signatures during React Native (Fabric) mount/unmount transactions. We root-caused two distinct mechanisms in the library's iOS implementation and validated fixes in production-style stress testing. Happy to send a PR if you agree with the approach.
Environment
@callstack/liquid-glass0.8.0- react-native 0.81.4 (New Architecture / Fabric)
- iOS 26.5 (simulator) and iOS 26.6 (device, field crashes)
Crash signatures observed
EXC_BAD_ACCESSin-[_UIPointerInteractionAssistant _assistantForView:]/-[UIView(UIPointerEventsPrivate) _containsView:]whileRCTMountingManager performTransactionmounts a child view (use-after-free — the assistant registry enumerates a freed view).NSInvalidArgumentException: -[__NSArrayM insertSublayer:atIndex:]: unrecognized selector(andOS_xpc_*/CALayerArrayvariants) during mounting — a freedCALayer's memory reused by an unrelated object, then messaged as a layer.
Both reproduce with rapid navigation churn across screens containing glass views (open/close product-detail screens with glass buttons/badges, tab switches). In our app this crashed roughly 1 in 3 sessions of ~100 navigations.
Root causes
1. Fabric children are mounted directly into UIVisualEffectView.contentView
- (void)mountChildComponentView:(UIView<RCTComponentViewProtocol> *)childComponentView index:(NSInteger)index {
[_view.contentView insertSubview:childComponentView atIndex:index];
}
Fabric assumes it exclusively owns the index space of the container it mounts into. On iOS 26, UIKit's glass/pointer machinery injects private subviews (e.g. _UIPointerEffectPlatterView) into the effect view hierarchy at runtime. Once an injected view lands in contentView, every Fabric index is off by one: subsequent insert/remove transactions operate on the wrong subviews, detaching views the framework still references — producing the freed-layer insertSublayer crashes above.
2. Live glass effect (and its pointer-interaction registration) survives recycle/dealloc
With isInteractive = true, UIGlassEffect registers the view with UIKit's pointer-interaction system. The component view never tears the effect down:
- when Fabric recycles the component view (
prepareForRecycle), the pooled instance keeps its live effect and registration; - when the view deallocates, the registration is never removed while the view is alive.
The next pointer-interaction registry walk (which UIKit performs during ordinary _addSubview passes) messages the freed view — the _UIPointerInteractionAssistant crash above.
Fix we validated
- Mount Fabric children into a dedicated plain
UIViewcontainer insidecontentView(autoresized to its bounds). UIKit can then inject anything into the effect hierarchy without disturbing Fabric's index space. - Add a
resetForRecycle()onLiquidGlassViewImplthat setseffect = niland clears cached state; call it fromprepareForRecycleanddeallocso UIKit unregisters the interactive-glass pointer machinery while the view is still alive.
Patch (applied via patch-package on 0.8.0):
--- a/ios/LiquidGlassView.mm
+++ b/ios/LiquidGlassView.mm
@@
@implementation LiquidGlassView {
LiquidGlassViewImpl * _view;
+ UIView * _childContainer;
BOOL _needsInvalidateLayer;
}
@@
_view = [[LiquidGlassViewImpl alloc] init];
-
+
+ _childContainer = [[UIView alloc] initWithFrame:CGRectZero];
+ _childContainer.autoresizingMask = UIViewAutoresizingFlexibleWidth | UIViewAutoresizingFlexibleHeight;
+ [_view.contentView addSubview:_childContainer];
+
self.contentView = _view;
}
return self;
}
+- (void)dealloc
+{
+ [_view resetForRecycle];
+}
+
@@
- (void)layoutSubviews {
[super layoutSubviews];
_view.layer.cornerRadius = self.layer.cornerRadius;
_view.layer.cornerCurve = self.layer.cornerCurve;
+ _childContainer.frame = _view.contentView.bounds;
}
+
+- (void)prepareForRecycle
+{
+ [super prepareForRecycle];
+ [_view resetForRecycle];
+}
@@
- (void)mountChildComponentView:(UIView<RCTComponentViewProtocol> *)childComponentView index:(NSInteger)index {
- [_view.contentView insertSubview:childComponentView atIndex:index];
+ [_childContainer insertSubview:childComponentView atIndex:index];
}
--- a/ios/LiquidGlassView.swift
+++ b/ios/LiquidGlassView.swift
@@
+ @objc public func resetForRecycle() {
+ self.effect = nil
+ appliedStyle = nil
+ appliedTintColor = nil
+ appliedInteractive = nil
+ isFirstMount = true
+ effectTintColor = nil
+ interactive = false
+ style = .regular
+ animated = true
+ animationDuration = 0
+ hasAnimationDuration = false
+ }
(Plus an empty resetForRecycle() on the non-iOS-26 fallback class so the ObjC call compiles on older SDK branches.)
Validation
Automated stress loop on iOS 26.5 simulator (Release configuration): repeated product-screen open/close over interactive glass buttons + tab switches, 10 runs x 15 navigation cycles. Before: crashes in ~1/3 of runs (both signatures). After: zero occurrences of either signature.
Related: facebook/react-native#55489 describes the same _UIPointerInteractionAssistant use-after-free pattern from the pointer-interaction side.
- 主要言語
- Objective-C++
- スター
- 1.7k
- フォーク
- 66
- PR マージ指標
- 30日以内にマージされた PR はありません
環境構築
- Dockerfile・Docker Compose ファイルなし
- プルリクエストのテンプレートなし
- コントリビューションガイドを読む
はじめの一歩
- issue を最後まで読み、次にプロジェクトのコントリビューションガイドを読みます。
- 着手することを issue にコメントします — 二人が同じ作業をするのを防げます。
- リポジトリをフォークし、ブランチを切って変更します。
- issue 番号を参照したプルリクエストを送ります。
callstack/liquid-glass のほかの issue
-
needs repro
難易度 4/5 3〜5日 初心者へのやさしさ 72/100
callstack/liquid-glass#47 · コメント 1 件 ·
-
bug
難易度 4/5 3〜5日 初心者へのやさしさ 48/100
callstack/liquid-glass#42 · コメント 1 件 ·
-
bug
難易度 3/5 1〜2日 初心者へのやさしさ 52/100
callstack/liquid-glass#41 ·
-
bug
難易度 4/5 3〜5日 初心者へのやさしさ 45/100
callstack/liquid-glass#33 · コメント 15 件 · リアクション 12 件 ·
-
bug
難易度 5/5 1週間以上 初心者へのやさしさ 20/100
callstack/liquid-glass#30 · コメント 1 件 · リアクション 3 件 ·
callstack/liquid-glass の issue をすべて見る
似ている issue
-
bug
難易度 2/5 1〜3時間 初心者へのやさしさ 78/100
メンテナーはふだん 2 日以内に返信
-
bug
難易度 2/5 1〜3時間 初心者へのやさしさ 66/100
IacobIonut01/ReFra#1388 ·
メンテナーはふだん 17 日以内に返信
-
難易度 2/5 1〜3時間 初心者へのやさしさ 82/100
apache/cordova-ios#1751 ·
メンテナーはふだん 1 日以内に返信
-
Tapping Model Copyright in the full-screen 3D model crashes the app対応中かも @garthvh が今日担当しました。 オープンbug
難易度 2/5 1〜3時間 初心者へのやさしさ 72/100
meshtastic/Meshtastic-Apple#2971 ·
メンテナーはふだん 1 日以内に返信
-
難易度 2/5 1〜3時間 初心者へのやさしさ 78/100
メンテナーはふだん 6 日以内に返信