dap: Avoid cloning *entire* stack frames when picking a thread

pull/574/head
Blaž Hrastnik 3 years ago
parent 5803de2067
commit 757babb1b4

@ -115,7 +115,6 @@ fn thread_picker(cx: &mut Context, callback_fn: impl Fn(&mut Editor, &dap::Threa
} }
let thread_states = debugger.thread_states.clone(); let thread_states = debugger.thread_states.clone();
let frames = debugger.stack_frames.clone();
let picker = FilePicker::new( let picker = FilePicker::new(
threads, threads,
move |thread| { move |thread| {
@ -129,8 +128,14 @@ fn thread_picker(cx: &mut Context, callback_fn: impl Fn(&mut Editor, &dap::Threa
.into() .into()
}, },
move |cx, thread, _action| callback_fn(cx.editor, thread), move |cx, thread, _action| callback_fn(cx.editor, thread),
move |_editor, thread| { move |editor, thread| {
if let Some(frame) = frames.get(&thread.id).and_then(|bt| bt.get(0)) { let frame = editor
.debugger
.as_ref()
.and_then(|debugger| debugger.stack_frames.get(&thread.id))
.and_then(|bt| bt.get(0));
if let Some(frame) = frame {
frame frame
.source .source
.as_ref() .as_ref()

Loading…
Cancel
Save