# workspace: Prompt to save dirty buffers when close would orphan them \(\#55889\) · gitcafe/zed

[View on GitCafe](https://git.cafe/gitcafe/zed/commit/00d8d45685673dae12c977e63e6502e3a95fa021)

Repository: [gitcafe/zed](https://git.cafe/gitcafe/zed)

Visibility: public

Requested revision: 00d8d45685673dae12c977e63e6502e3a95fa021

Requested commit: 00d8d45685673dae12c977e63e6502e3a95fa021

Commit: 00d8d45685673dae12c977e63e6502e3a95fa021

Tree: edc07605c48f286e266eaf4ebffb11ebb663c159

Author: Agus Zubiaga

Committer: GitHub

## Message

```
workspace: Prompt to save dirty buffers when close would orphan them (#55889)

The hot-exit shortcut in `save_all_internal` silently serializes dirty
buffers instead of prompting. It assumes the workspace will still be
reachable, but that's not true for `ReplaceWindow`, or for `CloseWindow`
of an empty workspace on macOS — both detach the workspace and orphan
its serialized buffers in the DB with no UI path back to them.

Only allow the shortcut when the workspace is actually recoverable
(`Quit`, `save_last_workspace`, or has visible worktrees). Otherwise
prompt.

Self-Review Checklist:

- [x] I've reviewed my own diff for quality, security, and reliability
- [x] Unsafe blocks (if any) have justifying comments
- [x] The content is consistent with the [UI/UX
checklist](https://github.com/zed-industries/zed/blob/main/CONTRIBUTING.md#uiux-checklist)
- [x] Tests cover the new/changed behavior
- [x] Performance impact has been considered and is acceptable

Closes #55726

Release Notes:

- Fixed unsaved untitled buffers being silently lost when opening a file
or project from an empty window
```

## Parents

- [7dc02263e78055fa032541ed90e070853625b2ce](https://git.cafe/gitcafe/zed/commit/7dc02263e78055fa032541ed90e070853625b2ce?format=markdown)

[Source at this commit](https://git.cafe/gitcafe/zed/tree/00d8d45685673dae12c977e63e6502e3a95fa021?format=markdown)
