Reduce accessibility of multibuffer read to reduce risk of borrowing snapshot and buffer refcells twice

This commit is contained in:
Keith Simmons 2022-05-13 16:58:30 -07:00
parent 2f7eb6dbc5
commit a2fd41174f
9 changed files with 36 additions and 17 deletions

View file

@ -84,7 +84,7 @@ impl OutlineView {
.read(cx)
.buffer()
.read(cx)
.read(cx)
.snapshot(cx)
.outline(Some(cx.global::<Settings>().theme.editor.syntax.as_ref()));
if let Some(outline) = buffer {
workspace.toggle_modal(cx, |_, cx| {
@ -171,8 +171,8 @@ impl PickerDelegate for OutlineView {
.collect();
let editor = self.active_editor.read(cx);
let buffer = editor.buffer().read(cx).read(cx);
let cursor_offset = editor.selections.newest::<usize>(cx).head();
let buffer = editor.buffer().read(cx).snapshot(cx);
selected_index = self
.outline
.items