From 7005c4baa4190f5f9f2e78579c7681a1adbff543 Mon Sep 17 00:00:00 2001 From: Tae Won Ha Date: Wed, 23 Aug 2017 17:38:54 +0200 Subject: [PATCH] GH-491 Exit full screen when closing the window to avoid crashes --- VimR/MainWindow.swift | 7 +++++++ 1 file changed, 7 insertions(+) diff --git a/VimR/MainWindow.swift b/VimR/MainWindow.swift index 5a97ce3c..04416187 100644 --- a/VimR/MainWindow.swift +++ b/VimR/MainWindow.swift @@ -410,6 +410,13 @@ extension MainWindow { func neoVimStopped() { self.isClosing = true + + // If we close the window in the full screen mode, either by clicking the close button or by invoking :q + // the main thread crashes. We exit the full screen mode here as a quick and dirty hack. + if self.window.styleMask.contains(.fullScreen) { + self.window.toggleFullScreen(nil) + } + self.windowController.close() self.set(dirtyStatus: false) self.emit(self.uuidAction(for: .close))