]> git.mxchange.org Git - flightgear.git/commitdiff
Tolerate old blocks support in 10.6 compiler.
authorJames Turner <zakalawe@mac.com>
Tue, 22 Jan 2013 17:33:16 +0000 (18:33 +0100)
committerJames Turner <zakalawe@mac.com>
Tue, 22 Jan 2013 17:33:16 +0000 (18:33 +0100)
src/GUI/CocoaFileDialog.mm

index c2bdbd9321babc05e09b410208251ac3792b5642..a16a7892f77c4440de099335529df7875a72da66 100644 (file)
@@ -27,6 +27,11 @@ static NSURL* pathToNSURL(const SGPath& aPath)
     return [NSURL fileURLWithPath:stdStringToCocoa(aPath.str())];
 }
 
+// 10.6 compiler won't accept block-scoped locals in Objective-C++,
+// so making these globals.
+static NSString* completion_path = nil;
+static SGPath completion_sgpath;
+
 class CocoaFileDialog::CocoaFileDialogPrivate
 {
 public:
@@ -117,14 +122,11 @@ void CocoaFileDialog::exec()
     
     [d->panel beginSheetModalForWindow:cocoaWindow completionHandler:^(NSInteger result)
     {
-        NSString* path = nil;
-        SGPath sgpath;
-        
         if (result == NSFileHandlingPanelOKButton) {
-            path = [[d->panel URL] path];
+            completion_path = [[d->panel URL] path];
             //NSLog(@"the URL is: %@", d->panel URL]);
-            sgpath = ([path UTF8String]);
-            _callback->onFileDialogDone(this, sgpath);
+            completion_sgpath = ([completion_path UTF8String]);
+            _callback->onFileDialogDone(this, completion_sgpath);
         }
     }];
 }