Fix crash when fallback workspace is in the removal set#53549
Merged
Fix crash when fallback workspace is in the removal set#53549
Conversation
beebc13 to
0df1669
Compare
When removing a project group, the fallback closure calls find_or_create_local_workspace which searches self.workspaces for an existing match. Because the workspaces to be removed haven't been removed yet at that point, workspace_for_paths can return a doomed workspace, hitting the assert in MultiWorkspace::remove. Fix by adding an `excluding` parameter to find_or_create_local_workspace so callers inside removal fallbacks can skip workspaces that are about to be removed. Both remove_project_group and sidebar::archive_thread now pass the appropriate exclusion set.
0df1669 to
c15c5bf
Compare
# Conflicts: # crates/workspace/src/multi_workspace.rs # crates/workspace/src/persistence.rs
a7cebe9 to
7e917af
Compare
eholk
approved these changes
Apr 13, 2026
piper-of-dawn
pushed a commit
to piper-of-dawn/zed
that referenced
this pull request
Apr 25, 2026
…es#53549) When removing a project group, the fallback closure calls `find_or_create_local_workspace` which searches `self.workspaces` for an existing match. Because the workspaces to be removed haven't been removed yet at that point, `workspace_for_paths` can return a doomed workspace, hitting the `assert!` in `MultiWorkspace::remove` and crashing the app. Fix by adding an `excluding` parameter to `find_or_create_local_workspace` so callers inside removal fallbacks can skip workspaces that are about to be removed. Both `remove_project_group` and `sidebar::archive_thread` now pass the appropriate exclusion set. Adds a regression test that deterministically reproduces the crash (the assert fires without the exclusion, passes with it). Release Notes: - Fixed a crash when closing a project group whose fallback workspace matched one being removed.
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
When removing a project group, the fallback closure calls
find_or_create_local_workspacewhich searchesself.workspacesfor an existing match. Because the workspaces to be removed haven't been removed yet at that point,workspace_for_pathscan return a doomed workspace, hitting theassert!inMultiWorkspace::removeand crashing the app.Fix by adding an
excludingparameter tofind_or_create_local_workspaceso callers inside removal fallbacks can skip workspaces that are about to be removed. Bothremove_project_groupandsidebar::archive_threadnow pass the appropriate exclusion set.Adds a regression test that deterministically reproduces the crash (the assert fires without the exclusion, passes with it).
Release Notes: