Skip to content

Commit

Permalink
Fix memory leak for NSMenuItem#setShortcut (#154)
Browse files Browse the repository at this point in the history
  • Loading branch information
sonsongithub committed Nov 27, 2023
1 parent 463f585 commit c252200
Showing 1 changed file with 1 addition and 0 deletions.
1 change: 1 addition & 0 deletions Sources/KeyboardShortcuts/NSMenuItem++.swift
Expand Up @@ -47,6 +47,7 @@ extension NSMenuItem {
public func setShortcut(for name: KeyboardShortcuts.Name?) {
guard let name else {
clearShortcut()
NotificationCenter.default.removeObserver(AssociatedKeys.observer[self] as Any)
AssociatedKeys.observer[self] = nil
return
}
Expand Down

0 comments on commit c252200

Please sign in to comment.