diff --git a/atom/browser/api/lib/app.coffee b/atom/browser/api/lib/app.coffee index a2fdb847e1c5..4d1803a0296f 100644 --- a/atom/browser/api/lib/app.coffee +++ b/atom/browser/api/lib/app.coffee @@ -54,7 +54,7 @@ deprecate.event app, 'finish-launching', 'ready', -> setImmediate => # give default app a chance to setup default menu. @emit 'finish-launching' deprecate.event app, 'activate-with-no-open-windows', 'activate', (event, hasVisibleWindows) -> - @emit 'activate-with-no-open-windows' if not hasVisibleWindows + @emit 'activate-with-no-open-windows', event if not hasVisibleWindows deprecate.event app, 'select-certificate', 'select-client-certificate' # Wrappers for native classes. diff --git a/atom/browser/native_window_mac.mm b/atom/browser/native_window_mac.mm index 7959eb04f55b..42894c107de4 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 {