diff --git a/libcef/browser/browser_host_impl_mac.mm b/libcef/browser/browser_host_impl_mac.mm index 95c4ca6e7..f04ecd75a 100644 --- a/libcef/browser/browser_host_impl_mac.mm +++ b/libcef/browser/browser_host_impl_mac.mm @@ -438,8 +438,12 @@ void RunOpenFileDialog(const CefBrowserHostImpl::FileChooserParams& params, [openPanel setShowsHiddenFiles:!params.hidereadonly]; // Show panel. - [openPanel beginSheetModalForWindow:[view window] completionHandler:nil]; - if ([openPanel runModal] == NSFileHandlingPanelOKButton) { + [openPanel beginSheetModalForWindow:[view window] + completionHandler:^(NSInteger returnCode) { + [NSApp stopModalWithCode:returnCode]; + }]; + NSInteger result = [NSApp runModalForWindow:[view window]]; + if (result == NSFileHandlingPanelOKButton) { NSArray *urls = [openPanel URLs]; int i, count = [urls count]; for (i=0; i