web: never resurface an emptied autosave-restore prompt

A queued AutosaveRestore startup modal can outlive the pending list
that justifies it: a file opened while the prompt is up displaces the
modal, the entry is consumed, and the after-message hook then resurfaces
a stale, empty Recover Drawing prompt. The hook now drops queued
restore prompts whose pending list is empty.

(cherry picked from commit 64160fd68d)
This commit is contained in:
Afonsop authored and Hakan Seven committed 2026-10-12 12:02:04 +03:00
1 parent 7b467e16ea
commit 9611f40400
1 file changed
+9
+9
View File
@@ -17,6 +17,15 @@ impl OpenCADStudio {
pub(super) fn show_next_startup_modal(&mut self) {
if self.active_modal.is_none() && self.opening.is_none() && self.pending_opens.is_empty() {
// A queued AutosaveRestore can outlive its pending list when a
// concurrent open displaces the modal and the entry is consumed
// meanwhile; resurfacing it would show an empty prompt.
#[cfg(target_arch = "wasm32")]
while self.pending_startup_modals.front() == Some(&ModalKind::AutosaveRestore)
&& self.web_autosave_pending.is_empty()
{
self.pending_startup_modals.pop_front();
}
if let Some(&kind) = self.pending_startup_modals.front() {
self.active_modal = Some(kind);
self.reset_modal_geometry();