From a190f42ccc23323d723f5c44cfee8984527a0d9a Mon Sep 17 00:00:00 2001 From: Cole Miller Date: Thu, 6 Feb 2025 19:33:41 -0500 Subject: [PATCH] Fix double-lease panic in Repository::activate (#24414) Release Notes: - N/A Co-authored-by: maxbrunsfeld --- crates/project/src/git.rs | 8 ++++---- 1 file changed, 4 insertions(+), 4 deletions(-) diff --git a/crates/project/src/git.rs b/crates/project/src/git.rs index fad10f1ba4c513..2c24a63079d9e2 100644 --- a/crates/project/src/git.rs +++ b/crates/project/src/git.rs @@ -314,16 +314,16 @@ impl Repository { .unwrap_or("".into()) } - pub fn activate(&self, cx: &mut App) { + pub fn activate(&self, cx: &mut Context) { let Some(git_state) = self.git_state.upgrade() else { return; }; + let entity = cx.entity(); git_state.update(cx, |git_state, cx| { - let Some((index, _)) = git_state + let Some(index) = git_state .repositories .iter() - .enumerate() - .find(|(_, handle)| handle.read(cx).id() == self.id()) + .position(|handle| *handle == entity) else { return; };