Commit b89da52
committed
Move removal of job into
The theory of the crash, produced during a rubber-ducking session with Claude:
* `find_words_with_subsequence_in_range` is called
* a job is scheduled and placed in `outstanding_workers`
* a call to `set_text_in_range` cancels a pending worker via `cancel_queued_workers` and `worker->Cancel`
* the worker is never removed from `outstanding_workers` because that happens in `Execute` — and we cancelled before the job got that far
* later, `set_text_in_range` triggers another call to `cancel_queued_workers`
* the already-cancelled job from before is still present in the set
* we try to call `Cancel` on it again, but the memory has been freed
The fix is to take the code that removes a job from `outstanding_workers` and move it from `Execute` to `OnWorkComplete`. The latter is guaranteed to be called, no matter how a job finished.
Because this is a theory produced by a man and his hallucinating robot, it's important to back it up with proof. The test added in the previous commit should now pass instead of crashing. So this fix works, even if there are slight flaws in the reasoning above.OnWorkComplete
1 parent 1f1caff commit b89da52
1 file changed
Lines changed: 5 additions & 5 deletions
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
623 | 623 | | |
624 | 624 | | |
625 | 625 | | |
| 626 | + | |
| 627 | + | |
| 628 | + | |
| 629 | + | |
| 630 | + | |
626 | 631 | | |
627 | 632 | | |
628 | 633 | | |
| |||
631 | 636 | | |
632 | 637 | | |
633 | 638 | | |
634 | | - | |
635 | | - | |
636 | | - | |
637 | | - | |
638 | | - | |
639 | 639 | | |
640 | 640 | | |
641 | 641 | | |
| |||
0 commit comments