Skip to content

Commit

Permalink
Limit recursivity calls when collecting sub process info
Browse files Browse the repository at this point in the history
  • Loading branch information
trufae committed Jan 16, 2020
1 parent 9709b8e commit 4bb55c8
Showing 1 changed file with 5 additions and 1 deletion.
6 changes: 5 additions & 1 deletion sources/iTermProcessCollection.m
Original file line number Diff line number Diff line change
Expand Up @@ -9,6 +9,8 @@
#import "iTermProcessCollection.h"
#import "NSArray+iTerm.h"

static const int maxDepth = 128;

@implementation iTermProcessInfo {
NSMutableArray *_children;
__weak iTermProcessInfo *_deepestForegroundJob;
Expand Down Expand Up @@ -57,7 +59,9 @@ - (iTermProcessInfo *)deepestForegroundJob:(NSInteger *)levelInOut visited:(NSMu
_deepestForegroundJob = self;
return self;
}

if (*levelInOut > maxDepth) {
return nil;
}
NSInteger bestLevel = *levelInOut;
iTermProcessInfo *bestProcessInfo = nil;
for (iTermProcessInfo *child in _children) {
Expand Down

0 comments on commit 4bb55c8

Please sign in to comment.