Report a merge worker that dies rather than leaving the page on Stop

wgpu reports a device out of memory by panicking, and a twelve-frame
merge on a GPU another process is using is where that happens. The panic
unwound the worker, the sender went with it, and the page sat on "Stop"
with every control disabled and nothing to say why — the crash record on
disk was the only sign. Catch the panic and send it as a failure, and
treat a closed channel with no final event as a dead worker too.
This commit is contained in:
2026-09-20 00:21:14 +02:00
parent 9c2cd73337
commit f176043632
2 changed files with 99 additions and 9 deletions
+11 -1
View File
@@ -487,11 +487,21 @@ fn chip_projection(i: i32) -> Option<dr_pano::Projection> {
/// Take everything the job has said and reflect it on the page.
fn drain(window: &AppWindow, ctl: &Rc<MergeController>, on_done: &Rc<impl Fn(&AppWindow)>) {
let events = {
let (events, gone) = {
let job = ctl.job.borrow();
let Some(job) = job.as_ref() else { return };
merge::drain(&job.rx)
};
// The worker is the only sender, so a closed channel with nothing final
// said is a worker that died without saying anything — the one way
// `merge::run` cannot report, since reporting is what it was doing.
// Without this the page stayed on "Stop" for ever.
let mut events = events;
if gone && !events.iter().any(MergeEvent::is_final) {
events.push(MergeEvent::Failed(
"the merge stopped unexpectedly; the log has the reason".into(),
));
}
if events.is_empty() {
return;
}