Remove special case for singleton buffers from MultiBufferSnapshot::anchor_at
(#36524)
This may be responsible for a panic that we've been seeing with increased frequency in agent2 threads. Release Notes: - N/A Co-authored-by: Conrad Irwin <conrad.irwin@gmail.com>
This commit is contained in:
parent
ec8106d1db
commit
b6722ca3c8
2 changed files with 43 additions and 31 deletions
|
@ -4876,11 +4876,7 @@ impl Editor {
|
|||
cx: &mut Context<Self>,
|
||||
) -> bool {
|
||||
let position = self.selections.newest_anchor().head();
|
||||
let multibuffer = self.buffer.read(cx);
|
||||
let Some(buffer) = position
|
||||
.buffer_id
|
||||
.and_then(|buffer_id| multibuffer.buffer(buffer_id))
|
||||
else {
|
||||
let Some(buffer) = self.buffer.read(cx).buffer_for_anchor(position, cx) else {
|
||||
return false;
|
||||
};
|
||||
|
||||
|
@ -5844,7 +5840,7 @@ impl Editor {
|
|||
multibuffer_anchor.start.to_offset(&snapshot)
|
||||
..multibuffer_anchor.end.to_offset(&snapshot)
|
||||
};
|
||||
if newest_anchor.head().buffer_id != Some(buffer.remote_id()) {
|
||||
if snapshot.buffer_id_for_anchor(newest_anchor.head()) != Some(buffer.remote_id()) {
|
||||
return None;
|
||||
}
|
||||
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue