Commit 14ba273
committed
Fix file_viewer: surface SearchStatus::Cancelled to the FE on cancel
search_cancel set the cancel flag and immediately nulled session.search.
That made the Cancelled state in the spawned search thread unobservable:
search_poll saw session.search == None and returned Idle, erasing the
'search was cancelled' signal the FE needs to distinguish 'completed
naturally' from 'aborted partway'. The Cancelled variant existed but had
no public path back to the caller.
Stop nulling session.search on cancel. The thread observes the flag,
exits its loop, and writes SearchStatus::Cancelled to the shared status
mutex. Subsequent polls see it. The next search_start atomically replaces
session.search with a fresh state, so the Cancelled status is naturally
cleared when a new search begins (search_start already calls search_cancel
first, so the contract holds end-to-end).
Update search_cancel_works to assert the observable Cancelled transition
instead of the previous 'Idle (because state was cleared)' behaviour.1 parent 36487e5 commit 14ba273
2 files changed
Lines changed: 25 additions & 5 deletions
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
391 | 391 | | |
392 | 392 | | |
393 | 393 | | |
| 394 | + | |
| 395 | + | |
| 396 | + | |
| 397 | + | |
| 398 | + | |
| 399 | + | |
394 | 400 | | |
395 | 401 | | |
396 | 402 | | |
| |||
400 | 406 | | |
401 | 407 | | |
402 | 408 | | |
403 | | - | |
404 | 409 | | |
405 | 410 | | |
406 | 411 | | |
| |||
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
164 | 164 | | |
165 | 165 | | |
166 | 166 | | |
167 | | - | |
| 167 | + | |
| 168 | + | |
| 169 | + | |
168 | 170 | | |
169 | 171 | | |
170 | | - | |
171 | | - | |
172 | | - | |
| 172 | + | |
| 173 | + | |
| 174 | + | |
| 175 | + | |
| 176 | + | |
| 177 | + | |
| 178 | + | |
| 179 | + | |
| 180 | + | |
| 181 | + | |
| 182 | + | |
| 183 | + | |
| 184 | + | |
| 185 | + | |
| 186 | + | |
| 187 | + | |
173 | 188 | | |
174 | 189 | | |
175 | 190 | | |
| |||
0 commit comments