diff options
-rw-r--r-- | macosx/tkMacOSXDialog.c | 24 |
1 files changed, 13 insertions, 11 deletions
diff --git a/macosx/tkMacOSXDialog.c b/macosx/tkMacOSXDialog.c index 42cb4a5..ba6fabd 100644 --- a/macosx/tkMacOSXDialog.c +++ b/macosx/tkMacOSXDialog.c @@ -346,23 +346,25 @@ static NSInteger showOpenSavePanel( NSWindow *parent, FilePanelCallbackInfo *callbackInfo) { - NSInteger modalReturnCode; + __block NSInteger modalReturnCode = modalOther; if (parent && ![parent attachedSheet]) { [panel beginSheetModalForWindow:parent - completionHandler:^(NSModalResponse returnCode) { - [NSApp tkFilePanelDidEnd:panel - returnCode:returnCode - contextInfo:callbackInfo ]; + completionHandler:^(NSModalResponse result) { + [NSApp tkFilePanelDidEnd:panel + returnCode:result + contextInfo:callbackInfo ]; + modalReturnCode = result; }]; - - modalReturnCode = callbackInfo->cmdObj ? modalOther : - [panel runModal]; } else { - modalReturnCode = [panel runModal]; - [NSApp tkFilePanelDidEnd:panel returnCode:modalReturnCode - contextInfo:callbackInfo]; + [panel beginWithCompletionHandler:^(NSModalResponse result) { + [NSApp tkFilePanelDidEnd:panel + returnCode:result + contextInfo:callbackInfo ]; + modalReturnCode = result; + }]; } + [panel runModal]; return modalReturnCode; } |