Remove redundant fetching of stack traces
This commit is contained in:
parent
0add0c5639
commit
9b8c5bdade
1 changed files with 2 additions and 11 deletions
|
@ -112,16 +112,7 @@ 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 mut top_frames: HashMap<isize, StackFrame> = HashMap::new();
|
let frames = debugger.stack_frames.clone();
|
||||||
for thread in threads.clone() {
|
|
||||||
if let Some(frame) = block_on(debugger.stack_trace(thread.id))
|
|
||||||
.ok()
|
|
||||||
.and_then(|(bt, _)| bt.get(0).cloned())
|
|
||||||
{
|
|
||||||
top_frames.insert(thread.id, frame);
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
let picker = FilePicker::new(
|
let picker = FilePicker::new(
|
||||||
threads,
|
threads,
|
||||||
move |thread| {
|
move |thread| {
|
||||||
|
@ -136,7 +127,7 @@ fn thread_picker(cx: &mut Context, callback_fn: impl Fn(&mut Editor, &dap::Threa
|
||||||
},
|
},
|
||||||
move |editor, thread, _action| callback_fn(editor, thread),
|
move |editor, thread, _action| callback_fn(editor, thread),
|
||||||
move |_editor, thread| {
|
move |_editor, thread| {
|
||||||
if let Some(frame) = top_frames.get(&thread.id) {
|
if let Some(frame) = frames.get(&thread.id).and_then(|bt| bt.get(0)) {
|
||||||
frame
|
frame
|
||||||
.source
|
.source
|
||||||
.as_ref()
|
.as_ref()
|
||||||
|
|
Loading…
Add table
Reference in a new issue