aboutsummaryrefslogtreecommitdiff
path: root/gui/browser_osx.mm
diff options
context:
space:
mode:
authorThierry Crozat2017-07-26 21:54:41 +0100
committerThierry Crozat2017-07-26 23:08:48 +0100
commit4981b4bbef89e4fad7673c03ca61a4c656d4b210 (patch)
treef0eda145232abdd08c2aade33ae4c45187ad816c /gui/browser_osx.mm
parent6162cd1c1947d9f254a9f0433fc145ecb7e17b72 (diff)
downloadscummvm-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.
Diffstat (limited to 'gui/browser_osx.mm')
-rw-r--r--gui/browser_osx.mm3
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