From 68964f1ca16ca52ac7e13793ae98cd31b09eb947 Mon Sep 17 00:00:00 2001 From: Kevin Sawicki Date: Wed, 4 Jun 2014 14:31:41 -0700 Subject: [PATCH] :checkered_flag: Don't crash when closing spec window Focusing the window during the blur event that fires when the window is closed currently crashes the app on Windows. Closes #2485 --- src/browser/atom-window.coffee | 8 +++++++- 1 file changed, 7 insertions(+), 1 deletion(-) diff --git a/src/browser/atom-window.coffee b/src/browser/atom-window.coffee index 912c567ab..9f0100930 100644 --- a/src/browser/atom-window.coffee +++ b/src/browser/atom-window.coffee @@ -114,9 +114,15 @@ class AtomWindow new ContextMenu(menuTemplate, this) if @isSpec + # Workaround for https://github.com/atom/atom-shell/issues/380 + # Don't focus the window when it is being blurred during close or + # else the app will crash on Windows. + if process.platform is 'win32' + @browserWindow.on 'close', => @isWindowClosing = true + # Spec window's web view should always have focus @browserWindow.on 'blur', => - @browserWindow.focusOnWebView() + @browserWindow.focusOnWebView() unless @isWindowClosing openPath: (pathToOpen, initialLine, initialColumn) -> if @loaded