diff options
author | Thierry Crozat | 2017-07-26 21:54:41 +0100 |
---|---|---|
committer | Thierry Crozat | 2017-07-26 23:08:48 +0100 |
commit | 4981b4bbef89e4fad7673c03ca61a4c656d4b210 (patch) | |
tree | f0eda145232abdd08c2aade33ae4c45187ad816c | |
parent | 6162cd1c1947d9f254a9f0433fc145ecb7e17b72 (diff) | |
download | scummvm-rg350-4981b4bbef89e4fad7673c03ca61a4c656d4b210.tar.gz scummvm-rg350-4981b4bbef89e4fad7673c03ca61a4c656d4b210.tar.bz2 scummvm-rg350-4981b4bbef89e4fad7673c03ca61a4c656d4b210.zip |
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.
-rw-r--r-- | gui/browser_osx.mm | 3 |
1 files changed, 3 insertions, 0 deletions
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 <AppKit/NSButton.h> #include <Foundation/NSString.h> #include <Foundation/NSURL.h> +#include <Foundation/NSAutoreleasePool.h> @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 |