From 3ac6b3c9e2ceed590b8aa921501743b68d4b35ce Mon Sep 17 00:00:00 2001 From: Cheng Zhao Date: Thu, 26 Nov 2015 13:55:59 +0800 Subject: [PATCH] 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. --- atom/browser/native_window_mac.mm | 5 +++++ 1 file changed, 5 insertions(+) diff --git a/atom/browser/native_window_mac.mm b/atom/browser/native_window_mac.mm index 28c8a5ae..a9ac0cb5 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 { -- 2.43.0