Remove references to windows when they close so that they will deallocate.
This commit is contained in:
parent
b6ff9e8ff4
commit
e920235038
|
@ -383,6 +383,12 @@ class AppDelegate: NSObject, NSApplicationDelegate, NSUserInterfaceValidations,
|
|||
}
|
||||
}
|
||||
|
||||
func removeMainWindow(_ windowController: MainWindowController) {
|
||||
if let index = mainWindowControllers.firstIndex(of: windowController) {
|
||||
mainWindowControllers.remove(at: index)
|
||||
}
|
||||
}
|
||||
|
||||
// MARK: NSUserInterfaceValidations
|
||||
func validateUserInterfaceItem(_ item: NSValidatedUserInterfaceItem) -> Bool {
|
||||
if shuttingDown {
|
||||
|
|
|
@ -462,7 +462,9 @@ extension MainWindowController: NSWindowDelegate {
|
|||
}
|
||||
|
||||
func windowWillClose(_ notification: Notification) {
|
||||
// TODO: now that we are deallocating main window controllers, the media playback stop can probably be removed
|
||||
detailViewController?.stopMediaPlayback()
|
||||
appDelegate.removeMainWindow(self)
|
||||
}
|
||||
|
||||
}
|
||||
|
|
Loading…
Reference in New Issue