Save As: don't open the rfd fallback after the portal dialog was given up (#6180)

Giving the dialog up cancels the request. If the portal then fails with an
error other than its cancellation code, the worker opened the rfd dialog even
though nothing was waiting for the answer, leaving an unwanted Save dialog on
screen. The fallback now checks this request's cancellation token first.
This commit is contained in:
batistalucasv committed 2026-11-12 12:52:55 -03:00
1 parent 2d286fe252
commit 664b033071
1 file changed
+11 -3
+11 -3
View File
@@ -168,9 +168,17 @@ impl Launcher {
Ok(Vec::new())
}
Err(e) => {
log::info!("portal save dialog unavailable ({e}), using rfd");
let picked = pick(picking, unparented, TOO_QUICK);
picked.map(|f| f.iter().map(|f| f.path().to_string_lossy().to_string()).collect())
// Giving the dialog up cancels the request. A portal that then
// fails with another error must not open the rfd dialog, which
// nothing would be waiting for.
if portal_arm.as_ref().is_some_and(|armed| armed.token.is_cancelled()) {
log::info!("portal save dialog given up ({e})");
Ok(Vec::new())
} else {
log::info!("portal save dialog unavailable ({e}), using rfd");
let picked = pick(picking, unparented, TOO_QUICK);
picked.map(|f| f.iter().map(|f| f.path().to_string_lossy().to_string()).collect())
}
}
}
} else {