Show prompt to force closing window when window is frozen.

Fixed atom/atom-shell#17.
This commit is contained in:
Cheng Zhao
2013-06-07 16:12:10 +08:00
parent bbde993e81
commit cb2bf796fa
2 changed files with 10 additions and 1 deletions

View File

@@ -247,7 +247,7 @@ class AtomApplication
if pidToKillWhenClosed?
@pidsToOpenWindows[pidToKillWhenClosed] = openedWindow
openedWindow.browserWindow.on 'closed', =>
openedWindow.browserWindow.on 'destroyed', =>
for pid, trackedWindow of @pidsToOpenWindows when trackedWindow is openedWindow
try
process.kill(pid)

View File

@@ -1,4 +1,5 @@
BrowserWindow = require 'browser-window'
dialog = require 'dialog'
ipc = require 'ipc'
module.exports =
@@ -21,6 +22,14 @@ class AtomWindow
@browserWindow.on 'destroyed', =>
global.atomApplication.removeWindow(this)
@browserWindow.on 'unresponsive', =>
chosen = dialog.showMessageBox
type: 'warning'
buttons: ['Close', 'Keep Waiting']
message: 'Editor window is frozen'
detail: "The editor window becomes frozen because of JavaScript dead loop, you can force closing it or just keep waiting."
@browserWindow.destroy() if chosen is 0
if @isSpec
# Spec window's web view should always have focus
@browserWindow.on 'blur', =>