From fef7df667c71f01211eb31603451ba8c9e082a5d Mon Sep 17 00:00:00 2001 From: Piotr Osiewicz <24362066+osiewicz@users.noreply.github.com> Date: Wed, 6 Nov 2024 13:58:51 +0100 Subject: [PATCH] pane: Update pinned tab counts when unnamed buffer is discarded (#20294) Closes #19492 Release Notes: - Fixed a crash that could happen when closing a workspace with pinned untitled buffers. --- crates/workspace/src/pane.rs | 9 +++++++-- 1 file changed, 7 insertions(+), 2 deletions(-) diff --git a/crates/workspace/src/pane.rs b/crates/workspace/src/pane.rs index 97672fd2455261d820866a55d015d47d76e43a38..b37298c7cacbe80ecd849e0ec403917662087764 100644 --- a/crates/workspace/src/pane.rs +++ b/crates/workspace/src/pane.rs @@ -1593,8 +1593,13 @@ impl Pane { Ok(0) => {} Ok(1) => { // Don't save this file - pane.update(cx, |_, cx| item.discarded(project, cx)) - .log_err(); + pane.update(cx, |pane, cx| { + if pane.is_tab_pinned(item_ix) && !item.can_save(cx) { + pane.pinned_tab_count -= 1; + } + item.discarded(project, cx) + }) + .log_err(); return Ok(true); } _ => return Ok(false), // Cancel