Commit 1e29576
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 4c623ae commit 1e29576
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 | | |
| |||
81 | 82 | | |
82 | 83 | | |
83 | 84 | | |
84 | | - | |
85 | | - | |
| 85 | + | |
| 86 | + | |
| 87 | + | |
| 88 | + | |
| 89 | + | |
| 90 | + | |
| 91 | + | |
| 92 | + | |
| 93 | + | |
86 | 94 | | |
87 | 95 | | |
88 | 96 | | |
| |||
0 commit comments