From 1bcfe5b5c70ea4bb8e7b8f648b41b84544ced185 Mon Sep 17 00:00:00 2001 From: Benjamin Pasero Date: Mon, 22 Jan 2018 19:00:47 +0100 Subject: [PATCH] fix #41989 --- src/vs/code/electron-main/windows.ts | 12 +++++++++++- 1 file changed, 11 insertions(+), 1 deletion(-) diff --git a/src/vs/code/electron-main/windows.ts b/src/vs/code/electron-main/windows.ts index 073f7dc441f..8ecf8499910 100644 --- a/src/vs/code/electron-main/windows.ts +++ b/src/vs/code/electron-main/windows.ts @@ -1326,7 +1326,17 @@ export class WindowsManager implements IWindowsMainService { } // Handle untitled workspaces with prompt as needed - e.veto(this.workspacesManager.promptToSaveUntitledWorkspace(this.getWindowById(e.window.id), workspace)); + e.veto(this.workspacesManager.promptToSaveUntitledWorkspace(this.getWindowById(e.window.id), workspace).then(veto => { + if (veto) { + return veto; + } + + // Bug in electron: somehow we need this timeout so that the window closes properly. That + // might be related to the fact that the untitled workspace prompt shows up async and this + // code can execute before the dialog is fully closed which then blocks the window from closing. + // Issue: https://github.com/Microsoft/vscode/issues/41989 + return TPromise.timeout(0).then(() => veto); + })); } public focusLastActive(cli: ParsedArgs, context: OpenContext): CodeWindow { -- GitLab