From b7091dd5e234cdf8549d8bba726f0cbe5d34ac59 Mon Sep 17 00:00:00 2001 From: Antonio Scandurra Date: Tue, 18 Jan 2022 10:13:50 +0100 Subject: [PATCH] Fix double borrow error when closing an item --- crates/workspace/src/pane.rs | 7 ++++--- 1 file changed, 4 insertions(+), 3 deletions(-) diff --git a/crates/workspace/src/pane.rs b/crates/workspace/src/pane.rs index b524fc8d56..31e73be50d 100644 --- a/crates/workspace/src/pane.rs +++ b/crates/workspace/src/pane.rs @@ -316,6 +316,10 @@ impl Pane { let mut item_ix = 0; self.item_views.retain(|(_, item_view)| { if item_view.id() == item_view_id { + if item_ix == self.active_item_index { + item_view.deactivated(cx); + } + let mut navigation = self.navigation.0.borrow_mut(); if let Some(path) = item_view.project_path(cx) { navigation.paths_by_item.insert(item_view.id(), path); @@ -323,9 +327,6 @@ impl Pane { navigation.paths_by_item.remove(&item_view.id()); } - if item_ix == self.active_item_index { - item_view.deactivated(cx); - } item_ix += 1; false } else {