How to avoid crash when closing NSWindow for agent macOS app
Issue #312
1 | class ClosableWindow: NSWindow { |
The reason is that window is released upon closed if it is not owned by NSWindowController
, or we can use releasedWhenClosed
The value of this property is YES if the window is automatically released after being closed; NO if it’s simply removed from the screen.
The default for NSWindow is YES; the default for NSPanel is NO. Release when closed, however, is ignored for windows owned by window controllers. Another strategy for releasing an NSWindow object is to have its delegate autorelease it on receiving a windowShouldClose: message.
Updated at 2020-12-14 05:18:30