Fix double-lease panic in Repository::activate (#24414)
Release Notes: - N/A Co-authored-by: maxbrunsfeld <max@zed.dev>
This commit is contained in:
parent
59bba2a98c
commit
a190f42ccc
1 changed files with 4 additions and 4 deletions
|
@ -314,16 +314,16 @@ impl Repository {
|
||||||
.unwrap_or("".into())
|
.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 {
|
let Some(git_state) = self.git_state.upgrade() else {
|
||||||
return;
|
return;
|
||||||
};
|
};
|
||||||
|
let entity = cx.entity();
|
||||||
git_state.update(cx, |git_state, cx| {
|
git_state.update(cx, |git_state, cx| {
|
||||||
let Some((index, _)) = git_state
|
let Some(index) = git_state
|
||||||
.repositories
|
.repositories
|
||||||
.iter()
|
.iter()
|
||||||
.enumerate()
|
.position(|handle| *handle == entity)
|
||||||
.find(|(_, handle)| handle.read(cx).id() == self.id())
|
|
||||||
else {
|
else {
|
||||||
return;
|
return;
|
||||||
};
|
};
|
||||||
|
|
Loading…
Add table
Add a link
Reference in a new issue