debugger: Fix crash when dragging pane items to split view#46806
Merged
Anthony-Eid merged 6 commits intozed-industries:mainfrom Jan 20, 2026
Merged
debugger: Fix crash when dragging pane items to split view#46806Anthony-Eid merged 6 commits intozed-industries:mainfrom
Anthony-Eid merged 6 commits intozed-industries:mainfrom
Conversation
cd75b22 to
29901f9
Compare
- Defer split+move operation via cx.spawn_in() to avoid double borrow of Pane entity - Replace unwrap() with graceful returns in activate_item and run_in_terminal - Handle members/bounding_boxes length mismatch in pane_at_pixel_position Closes zed-industries#46784
29901f9 to
79aa9bc
Compare
Contributor
Author
|
Hi @Anthony-Eid, ready for review! Please take a look whenever you have a moment. Thanks! |
Anthony-Eid
reviewed
Jan 15, 2026
crates/workspace/src/pane_group.rs
Outdated
Comment on lines
+880
to
+883
| debug_assert!(self.members.len() == self.bounding_boxes.lock().len()); | ||
|
|
||
| let bounding_boxes = self.bounding_boxes.lock(); | ||
| if self.members.len() != bounding_boxes.len() { | ||
| return None; | ||
| } |
Contributor
There was a problem hiding this comment.
Let's leave the debug_assert here.
If this assertion fails in a debug build that means there's another bug we have to fix
Add debug assertion to help detect underlying bug in debug builds.
Contributor
Author
|
Hi @Anthony-Eid. Added debug_assert! back per review feedback. Ready for re-review. |
Contributor
Author
|
Hi @Anthony-Eid, everything is ready for preview. Could you please take a look when you have a moment? Thanks! |
We shouldn't be spawning a foreground task unless we need async
Contributor
|
/cherry-pick preview |
Contributor
|
🍒💥 Cherry-pick did not succeed |
Anthony-Eid
added a commit
that referenced
this pull request
Jan 28, 2026
…t originated from that pane (#46806) Closes #46784 This panic was caused by a double borrow when the pane an item was moved too is the same pane the item originate from. The fix was using a window.defer to avoid the double lease, instead of updating in a Context<Pane> Release Notes: --------- Co-authored-by: Anthony Eid <anthony@zed.dev>
zcg
pushed a commit
to zcg/zedpro
that referenced
this pull request
Jan 29, 2026
…tries#46806) ## Summary Fixes crash when dragging debugger panel items (terminal/console/variables/frames) to another pane as split view. **Root causes:** 1. Double borrow panic - `pane_group.split()` was called synchronously inside a `Context<Pane>` update, causing "cannot update Pane while it is already being updated" 2. `unwrap()` calls that panic when items are in transition during drag operations 3. `debug_assert!` in `pane_at_pixel_position` fails when `members` and `bounding_boxes` are temporarily out of sync after deferred split **Fixes:** - Defer entire split+move operation via `cx.spawn_in()` to avoid double borrow - Replace `unwrap()` with graceful early returns in `activate_item` and `run_in_terminal` - Handle `members.len() != bounding_boxes.len()` gracefully in `pane_at_pixel_position` Closes zed-industries#46784 Closes #ISSUE Release Notes: - N/A *or* Added/Fixed/Improved ... --------- Co-authored-by: Anthony Eid <anthony@zed.dev>
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.
Closes #46784
This panic was caused by a double borrow when the pane an item was moved too is the same pane the item originate from. The fix was using a
window.deferto avoid the double lease, instead of updating in aContext<Pane>Release Notes: