Skip to content

Commit 955c810

Browse files
authored
fix: workaround for deadlock on iOS 18 (#449)
1 parent c738db5 commit 955c810

File tree

2 files changed

+8
-0
lines changed

2 files changed

+8
-0
lines changed

super_native_extensions/lib/src/widget_snapshot/widget_snapshotter_internal.dart

Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -103,6 +103,12 @@ class WidgetSnapshotterStateImpl extends WidgetSnapshotterState {
103103
// We have pending snapshot for widget that we haven't built yet
104104
if (_pendingSnapshots.any((s) => _getRenderObject(s.key) == null)) {
105105
setState(() {});
106+
// TODO(knopp): This is fragile and the underlying reason for the deadlock
107+
// needs to be investigates.
108+
// On iOS 18 next frame vsync never comes while the run loop is being
109+
// polled. This is a ugly workaround to make sure that we do not
110+
// deadlock.
111+
WidgetsBinding.instance.scheduleWarmUpFrame();
106112
WidgetsBinding.instance.addPostFrameCallback((timeStamp) {
107113
_checkSnapshots();
108114
});

super_native_extensions/rust/src/lib.rs

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -7,6 +7,8 @@
77
#![allow(clippy::arc_with_non_send_sync)]
88
// TODO(knopp): Fine grained way to prevent dead code warnings in code that is not used on all platforms.
99
#![allow(dead_code)]
10+
// TODO(knopp): Remove once supported on stable
11+
#![allow(clippy::needless_lifetimes)]
1012

1113
use std::ffi::c_void;
1214

0 commit comments

Comments
 (0)