Commit 0c4eb09
Till Friebe
fix(connectivity_plus): guard eventSink against FlutterEngine teardown on iOS
NWPathMonitor can fire a connectivity update while the app is in the
background, after the FlutterEngine's shell has been torn down. The
DispatchQueue.main.async block then invokes the stale FlutterEventSink,
which calls -[FlutterEngine sendOnChannel:] and hits an NSAssertion at
FlutterEngine.mm:1315, aborting the process with SIGABRT.
Guard the main-queue emission with [weak self], a local eventSink copy,
and a UIApplication.applicationState != .background check so that
pending updates are dropped instead of propagated into a dead engine.
The next onListen / check call after foregrounding will resync state.1 parent 9f03424 commit 0c4eb09
1 file changed
Lines changed: 10 additions & 2 deletions
File tree
- packages/connectivity_plus/connectivity_plus/ios/connectivity_plus/Sources/connectivity_plus
Lines changed: 10 additions & 2 deletions
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
3 | 3 | | |
4 | 4 | | |
5 | 5 | | |
| 6 | + | |
6 | 7 | | |
7 | 8 | | |
8 | 9 | | |
| |||
79 | 80 | | |
80 | 81 | | |
81 | 82 | | |
82 | | - | |
83 | | - | |
| 83 | + | |
| 84 | + | |
| 85 | + | |
| 86 | + | |
| 87 | + | |
| 88 | + | |
| 89 | + | |
| 90 | + | |
| 91 | + | |
84 | 92 | | |
85 | 93 | | |
86 | 94 | | |
| |||
0 commit comments