Skip to content

Commit 376c52b

Browse files
committed
fixes #28198
1 parent 586d578 commit 376c52b

File tree

2 files changed

+11
-11
lines changed

2 files changed

+11
-11
lines changed

src/vs/workbench/parts/debug/common/debugModel.ts

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -435,17 +435,17 @@ export class Thread implements IThread {
435435
* Only fetches the first stack frame for performance reasons. Calling this method consecutive times
436436
* gets the remainder of the call stack.
437437
*/
438-
public fetchCallStack(): TPromise<void> {
438+
public fetchCallStack(smartFetch = true): TPromise<void> {
439439
if (!this.stopped) {
440440
return TPromise.as(null);
441441
}
442442

443-
if (!this.fetchPromise) {
443+
if (!this.fetchPromise && smartFetch) {
444444
this.fetchPromise = this.getCallStackImpl(0, 1).then(callStack => {
445445
this.callStack = callStack || [];
446446
});
447447
} else {
448-
this.fetchPromise = this.fetchPromise.then(() => this.getCallStackImpl(this.callStack.length, 20).then(callStackSecondPart => {
448+
this.fetchPromise = (this.fetchPromise || TPromise.as(null)).then(() => this.getCallStackImpl(this.callStack.length, 20).then(callStackSecondPart => {
449449
this.callStack = this.callStack.concat(callStackSecondPart);
450450
}));
451451
}

src/vs/workbench/parts/debug/electron-browser/debugViewer.ts

Lines changed: 8 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -354,7 +354,7 @@ export class CallStackDataSource implements IDataSource {
354354

355355
public getChildren(tree: ITree, element: any): TPromise<any> {
356356
if (element instanceof Thread) {
357-
return TPromise.as(this.getThreadChildren(element));
357+
return this.getThreadChildren(element);
358358
}
359359
if (element instanceof Model) {
360360
return TPromise.as(element.getProcesses());
@@ -364,25 +364,25 @@ export class CallStackDataSource implements IDataSource {
364364
return TPromise.as(process.getAllThreads());
365365
}
366366

367-
private getThreadChildren(thread: Thread): any[] {
367+
private getThreadChildren(thread: Thread): TPromise<any> {
368368
const callStack: any[] = thread.getCallStack();
369-
if (!callStack) {
370-
return [];
369+
if (!callStack || !callStack.length) {
370+
return thread.fetchCallStack(false).then(() => thread.getCallStack());
371371
}
372372
if (callStack.length === 1) {
373373
// To reduce flashing of the call stack view simply append the stale call stack
374374
// once we have the correct data the tree will refresh and we will no longer display it.
375-
return callStack.concat(thread.getStaleCallStack().slice(1));
375+
return TPromise.as(callStack.concat(thread.getStaleCallStack().slice(1)));
376376
}
377377

378378
if (thread.stoppedDetails && thread.stoppedDetails.framesErrorMessage) {
379-
return callStack.concat([thread.stoppedDetails.framesErrorMessage]);
379+
return TPromise.as(callStack.concat([thread.stoppedDetails.framesErrorMessage]));
380380
}
381381
if (thread.stoppedDetails && thread.stoppedDetails.totalFrames > callStack.length && callStack.length > 1) {
382-
return callStack.concat([new ThreadAndProcessIds(thread.process.getId(), thread.threadId)]);
382+
return TPromise.as(callStack.concat([new ThreadAndProcessIds(thread.process.getId(), thread.threadId)]));
383383
}
384384

385-
return callStack;
385+
return TPromise.as(callStack);
386386
}
387387

388388
public getParent(tree: ITree, element: any): TPromise<any> {

0 commit comments

Comments
 (0)