@@ -367,23 +367,27 @@ export class CallStackDataSource implements IDataSource {
367367
368368 private getThreadChildren ( thread : Thread ) : TPromise < any > {
369369 let callStack : any [ ] = thread . getCallStack ( ) ;
370+ let callStackPromise : TPromise < any > = TPromise . as ( null ) ;
370371 if ( ! callStack || ! callStack . length ) {
371- thread . fetchCallStack ( ) . then ( ( ) => callStack = thread . getCallStack ( ) ) ;
372- }
373- if ( callStack . length === 1 ) {
374- // To reduce flashing of the call stack view simply append the stale call stack
375- // once we have the correct data the tree will refresh and we will no longer display it.
376- return TPromise . as ( callStack . concat ( thread . getStaleCallStack ( ) . slice ( 1 ) ) ) ;
372+ callStackPromise = thread . fetchCallStack ( ) . then ( ( ) => callStack = thread . getCallStack ( ) ) ;
377373 }
378374
379- if ( thread . stoppedDetails && thread . stoppedDetails . framesErrorMessage ) {
380- return TPromise . as ( callStack . concat ( [ thread . stoppedDetails . framesErrorMessage ] ) ) ;
381- }
382- if ( thread . stoppedDetails && thread . stoppedDetails . totalFrames > callStack . length && callStack . length > 1 ) {
383- return TPromise . as ( callStack . concat ( [ new ThreadAndProcessIds ( thread . process . getId ( ) , thread . threadId ) ] ) ) ;
384- }
375+ return callStackPromise . then ( ( ) => {
376+ if ( callStack . length === 1 ) {
377+ // To reduce flashing of the call stack view simply append the stale call stack
378+ // once we have the correct data the tree will refresh and we will no longer display it.
379+ return callStack . concat ( thread . getStaleCallStack ( ) . slice ( 1 ) ) ;
380+ }
385381
386- return TPromise . as ( callStack ) ;
382+ if ( thread . stoppedDetails && thread . stoppedDetails . framesErrorMessage ) {
383+ return callStack . concat ( [ thread . stoppedDetails . framesErrorMessage ] ) ;
384+ }
385+ if ( thread . stoppedDetails && thread . stoppedDetails . totalFrames > callStack . length && callStack . length > 1 ) {
386+ return callStack . concat ( [ new ThreadAndProcessIds ( thread . process . getId ( ) , thread . threadId ) ] ) ;
387+ }
388+
389+ return callStack ;
390+ } ) ;
387391 }
388392
389393 public getParent ( tree : ITree , element : any ) : TPromise < any > {
0 commit comments