Skip to content
Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
7 changes: 7 additions & 0 deletions Rectangle/Utilities/EventMonitor.swift
Original file line number Diff line number Diff line change
Expand Up @@ -79,6 +79,13 @@ public class ActiveEventMonitor: EventMonitor {
thread!.cancel()
thread = nil
CGEvent.tapEnable(tap: tap, enable: false)
// CoreGraphics holds internal references to the CFMachPort from tapCreate, so
// releasing ours never deallocates it; without an explicit invalidate, the
// WindowServer keeps the (disabled) tap registration until the process exits.
// stop()/start() cycles (app switches while snapping is active, and the
// tapDisabledByTimeout recovery above) would otherwise each leak one entry,
// degrading system-wide input latency once they accumulate.
CFMachPortInvalidate(tap)
}
tap = nil
}
Expand Down
Loading