# terminal: Fix pane re-entrancy panic when splitting terminal tabs \(\#45231\) · gitcafe/zed

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

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

Visibility: public

Requested revision: f9462da2f7cdd0bfdb0feb95ae983fe695bb0a86

Requested commit: f9462da2f7cdd0bfdb0feb95ae983fe695bb0a86

Commit: f9462da2f7cdd0bfdb0feb95ae983fe695bb0a86

Tree: 2bec93dc6b12d0293ffee64de71d71ba871f0052

Author: Ahmed M\. Ammar

Committer: GitHub

## Message

```
terminal: Fix pane re-entrancy panic when splitting terminal tabs (#45231)

## Summary
Fix panic "cannot update workspace::pane::Pane while it is already being
updated" when dragging terminal tabs to split the pane.

## Problem
When dragging a terminal tab to create a split, the app panics due to
re-entrancy: the drop handler calls `terminal_panel.center.split()`
synchronously, which invokes `mark_positions()` that tries to update all
panes in the group. When the pane being updated is part of the terminal
panel's center group, this causes a re-entrancy panic.

## Solution
Defer the split operation using `cx.spawn_in()`, similar to how
`move_item` was already deferred in the same handler. This ensures the
split (and subsequent `mark_positions()` call) runs after the current
pane update completes.

## Test plan
- Open terminal panel
- Create a terminal tab
- Drag the terminal tab to split the pane
- Verify no panic occurs and split works correctly
```

## Parents

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

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