mirror of
https://github.com/zed-industries/zed.git
synced 2024-12-29 04:20:46 +00:00
Don't delete buffer state when calling get_open_buffer
...as we might be in the process of completing a request that could open a buffer. This was causing a failure in the randomized integration test.
This commit is contained in:
parent
5f7a759870
commit
1313ca8415
1 changed files with 9 additions and 13 deletions
|
@ -811,24 +811,20 @@ impl Project {
|
|||
path: &ProjectPath,
|
||||
cx: &mut ModelContext<Self>,
|
||||
) -> Option<ModelHandle<Buffer>> {
|
||||
let mut result = None;
|
||||
let worktree = self.worktree_for_id(path.worktree_id, cx)?;
|
||||
self.buffers_state
|
||||
.borrow_mut()
|
||||
.borrow()
|
||||
.open_buffers
|
||||
.retain(|_, buffer| {
|
||||
if let Some(buffer) = buffer.upgrade(cx) {
|
||||
if let Some(file) = File::from_dyn(buffer.read(cx).file()) {
|
||||
if file.worktree == worktree && file.path() == &path.path {
|
||||
result = Some(buffer);
|
||||
}
|
||||
}
|
||||
true
|
||||
.values()
|
||||
.find_map(|buffer| {
|
||||
let buffer = buffer.upgrade(cx)?;
|
||||
let file = File::from_dyn(buffer.read(cx).file())?;
|
||||
if file.worktree == worktree && file.path() == &path.path {
|
||||
Some(buffer)
|
||||
} else {
|
||||
false
|
||||
None
|
||||
}
|
||||
});
|
||||
result
|
||||
})
|
||||
}
|
||||
|
||||
fn register_buffer(
|
||||
|
|
Loading…
Reference in a new issue