mac: Clears the delegate when window is going to be closed

Since EL Capitan it is possible that the methods of delegate would get
called after the window has been closed.

Refs atom/atom#9584.
This commit is contained in:
Cheng Zhao 2015-11-26 13:55:59 +08:00
parent 8ce19d8059
commit 6c1878d15b

View file

@ -192,6 +192,11 @@ bool ScopedDisableResize::disable_resize_ = false;
- (void)windowWillClose:(NSNotification*)notification {
shell_->NotifyWindowClosed();
// Clears the delegate when window is going to be closed, since EL Capitan it
// is possible that the methods of delegate would get called after the window
// has been closed.
[shell_->GetNativeWindow() setDelegate:nil];
}
- (BOOL)windowShouldClose:(id)window {