From 025aa49f6780b8cf238b6ac7567d720ef7708438 Mon Sep 17 00:00:00 2001 From: Nitish Sakhawalkar Date: Sat, 10 Nov 2018 05:53:35 -0800 Subject: [PATCH] fix: NSWindow crash happening on macos 10.9 (#15660) --- 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 957a9ccaf051..70f7f88384e7 100644 --- a/atom/browser/native_window_mac.mm +++ b/atom/browser/native_window_mac.mm @@ -517,6 +517,11 @@ void NativeWindowMac::Close() { } void NativeWindowMac::CloseImmediately() { + // Retain the child window before closing it. If the last reference to the + // NSWindow goes away inside -[NSWindow close], then bad stuff can happen. + // See e.g. http://crbug.com/616701. + base::scoped_nsobject child_window(window_, + base::scoped_policy::RETAIN); [window_ close]; }