Skip to content

Multi-window: closing a window can close the wrong document, and the save prompt can lock up #7822

Backlog

Description

@benandez

With two or more document windows open, closing a window can close the wrong document, and the close guard (the "save changes?" prompt) can lock up for good. This is the one open data-loss risk after the craft-ui port (#7101).

Reports: #7752 (closing the first window moves the second document into its place), #7470, #7741, and before the port #6423, #6836, #6927, #7051. #7169 (second windows blank) was fixed by storytold/craft-libs#2744; confirm while testing.

Causes, from the #7317 audit (read from the code, not re-verified):

  • W1-1 (C5-1..3): the fallback for a host without separate viewports is split between !viewports_available() and !opens_windows(); closing acts on root_key() instead of the document the window shows (shown); ui.closeWindow should resolve the active_viewport().
  • W1-2 (C5-4): CloseGuard isn't serialised (self.closing), the prompt isn't bound to the WindowId that owns it, and sync_document doesn't reconcile before follow_in_windows, which leaves a permanent Hold.
  • ARCHIVE: Upstream audit and remediation roadmap after #7101 (live tracker: #7671) #7317 W8 "C4-5": close_window returns early while closing.is_some(), so a clean window can't close, and pending_nudge leaks between dialog_host viewports. Same code as W1-2.
  • W1-3 (C5-6/7, P2): with three windows, other_window_on_document should filter w.doc == doc, and queue_for_window should repaint the target viewport.
  • craft-libs: C5-5 (cursor::image_target rejects non-ROOT viewports) and C5-8 (the UI test kit's Windows supports one child; three-window tests need N).

storytold/craft-libs#3290 (one modal stack across viewports) lands with the next repin and changes part of this; design the fix after that repin. Needs a short spec first (close paths, prompt ownership, fallback hosts) and a test per close path.

Part of #7671.

Metadata

Metadata

Assignees

No one assigned

    Labels

    bugbugfixpriority: highui

    Type

    No type

    Projects

    No projects

      Milestone

      No milestone

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions