Skip to content

Commit

Permalink
Fix double-lease panic in Repository::activate (#24414)
Browse files Browse the repository at this point in the history
Release Notes:

- N/A

Co-authored-by: maxbrunsfeld <max@zed.dev>
  • Loading branch information
cole-miller and maxbrunsfeld authored Feb 7, 2025
1 parent 59bba2a commit a190f42
Showing 1 changed file with 4 additions and 4 deletions.
8 changes: 4 additions & 4 deletions crates/project/src/git.rs
Original file line number Diff line number Diff line change
Expand Up @@ -314,16 +314,16 @@ impl Repository {
.unwrap_or("".into())
}

pub fn activate(&self, cx: &mut App) {
pub fn activate(&self, cx: &mut Context<Self>) {
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;
};
Expand Down

0 comments on commit a190f42

Please sign in to comment.