Commit 26d34e1
committed
fix(android): don't crash in Fragment.onCreateView on stale-fragment race
onCreateView already returns null when its entry, resolvedPage, or frame is
missing, but it first called Trace.error, which rethrows through the registered
error handler across the JNI boundary and turns the recoverable case into a
fatal "Calling js method onCreateView failed" crash.
These nulls happen when the FragmentManager drives a stale fragment to
CREATE_VIEW after NativeScript has already torn down the corresponding
backstack entry (process death / activity recreation after rotation or
theme change, clearHistory, or rapid navigate+goBack). The fragment should
just be discarded, not crash the app.
Downgrade the three guards to Trace.messageType.warn so the existing
return-null recovery path is actually reached, consistent with the existing
onDestroy handling of the same race.1 parent 6bc5383 commit 26d34e1
1 file changed
Lines changed: 15 additions & 3 deletions
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
112 | 112 | | |
113 | 113 | | |
114 | 114 | | |
115 | | - | |
| 115 | + | |
| 116 | + | |
| 117 | + | |
| 118 | + | |
| 119 | + | |
| 120 | + | |
116 | 121 | | |
117 | 122 | | |
118 | 123 | | |
119 | 124 | | |
120 | 125 | | |
121 | 126 | | |
122 | | - | |
| 127 | + | |
| 128 | + | |
| 129 | + | |
| 130 | + | |
123 | 131 | | |
124 | 132 | | |
125 | 133 | | |
126 | 134 | | |
127 | 135 | | |
128 | 136 | | |
129 | | - | |
| 137 | + | |
| 138 | + | |
| 139 | + | |
| 140 | + | |
| 141 | + | |
130 | 142 | | |
131 | 143 | | |
132 | 144 | | |
| |||
0 commit comments