Commit 022a11a
committed
fix(linux): Fix iterator in test backspace handling
Replace reverse iterator loop that holds a stale iterator across
pop_back() calls with a pattern that directly accesses context.back()
on each iteration. This avoids undefined behavior from iterator
invalidation when mutating the vector.
The previous code was similar to the code used in production
(ldml_process.cpp, ldml_event_state::emit_backspace()). However,
in production we use a list where this works, but here in the tests
we use a vector where the behavior is undefined.
Test-bot: skip1 parent 6540886 commit 022a11a
1 file changed
+10
-11
lines changed| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
157 | 157 | | |
158 | 158 | | |
159 | 159 | | |
160 | | - | |
161 | | - | |
162 | | - | |
163 | | - | |
164 | | - | |
165 | | - | |
166 | | - | |
167 | | - | |
168 | | - | |
169 | | - | |
| 160 | + | |
| 161 | + | |
| 162 | + | |
| 163 | + | |
| 164 | + | |
170 | 165 | | |
| 166 | + | |
171 | 167 | | |
172 | | - | |
| 168 | + | |
| 169 | + | |
173 | 170 | | |
| 171 | + | |
174 | 172 | | |
| 173 | + | |
175 | 174 | | |
176 | 175 | | |
177 | 176 | | |
| |||
0 commit comments