Skip to content

Commit

Permalink
Fix build warning 'observer' mutated after capture by sendable closure
Browse files Browse the repository at this point in the history
  • Loading branch information
lapcat committed Jun 13, 2023
1 parent 701c417 commit 6e17ef6
Showing 1 changed file with 2 additions and 2 deletions.
4 changes: 2 additions & 2 deletions source/LicenseWindowController.swift
Original file line number Diff line number Diff line change
Expand Up @@ -2,6 +2,7 @@ import Cocoa

class LicenseWindowController {
private static var licenseWindow:NSWindow?
private static var observer:NSObjectProtocol?

static func open() {
if let window = licenseWindow {
Expand Down Expand Up @@ -51,9 +52,8 @@ class LicenseWindowController {

licenseWindow = window

var observer:NSObjectProtocol!
observer = NotificationCenter.default.addObserver(forName:NSWindow.willCloseNotification, object:licenseWindow, queue:nil, using:{_ in
NotificationCenter.default.removeObserver(observer)
NotificationCenter.default.removeObserver(observer!)
licenseWindow = nil
})
}
Expand Down

0 comments on commit 6e17ef6

Please sign in to comment.