From: Cheng Zhao Date: Thu, 26 Nov 2015 05:55:59 +0000 (+0800) Subject: mac: Clears the delegate when window is going to be closed X-Git-Tag: v0.35.2~10^2~1 X-Git-Url: http://git.khamidou.com/?a=commitdiff_plain;h=6c1878d15b8c34f1441565ebacaaf34247276b30;p=electron.git 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. --- diff --git a/atom/browser/native_window_mac.mm b/atom/browser/native_window_mac.mm index 7959eb04..42894c10 100644 --- a/atom/browser/native_window_mac.mm +++ b/atom/browser/native_window_mac.mm @@ -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 {