Skip to content

Commit e97ca42

Browse files
committed
Fix use-after-free crash in iTermProcessMonitor
When child monitors are removed from the tree, their dispatch sources must be invalidated before the monitor is deallocated. Without this, the dispatch source is still active when the monitor is freed, causing a crash in _dispatch_queue_xref_dispose.
1 parent 92ea90a commit e97ca42

1 file changed

Lines changed: 1 addition & 0 deletions

File tree

sources/iTermProcessMonitor.m

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -116,6 +116,7 @@ - (BOOL)setProcessInfo:(iTermProcessInfo *)processInfo depth:(NSInteger)depth {
116116
[self addChild:child];
117117
}];
118118
[childrenToRemove enumerateObjectsUsingBlock:^(iTermProcessMonitor * _Nonnull child, NSUInteger idx, BOOL * _Nonnull stop) {
119+
[child invalidate];
119120
[self removeChild:child];
120121
}];
121122
if (childrenToAdd.count || childrenToRemove.count) {

0 commit comments

Comments
 (0)