From 4981b4bbef89e4fad7673c03ca61a4c656d4b210 Mon Sep 17 00:00:00 2001 From: Thierry Crozat Date: Wed, 26 Jul 2017 21:54:41 +0100 Subject: OSX: Make sure to release the NSOpenPanel immediately after closing it This is an attempt to fix a difficult to reproduce issue where the NSOpenPanel remains open in the background and locks the application. Some tests suggest that it might fix the issue, but only time will tell. --- gui/browser_osx.mm | 3 +++ 1 file changed, 3 insertions(+) (limited to 'gui/browser_osx.mm') diff --git a/gui/browser_osx.mm b/gui/browser_osx.mm index 9bc163cf8f..6977d14f82 100644 --- a/gui/browser_osx.mm +++ b/gui/browser_osx.mm @@ -37,6 +37,7 @@ #include #include #include +#include @interface ShowHiddenFilesController : NSObject { NSOpenPanel* _panel; @@ -126,6 +127,7 @@ int BrowserDialog::runModal() { // Temporarily show the real mouse CGDisplayShowCursor(kCGDirectMainDisplay); + NSAutoreleasePool *pool = [[NSAutoreleasePool alloc] init]; NSWindow *keyWindow = [[NSApplication sharedApplication] keyWindow]; NSOpenPanel *panel = [NSOpenPanel openPanel]; @@ -174,6 +176,7 @@ int BrowserDialog::runModal() { [showHiddenFilesButton release]; [showHiddenFilesController release]; + [pool release]; [keyWindow makeKeyAndOrderFront:nil]; // While the native macOS file browser is open, any input events (e.g. keypresses) are -- cgit v1.2.3