[Scummvm-git-logs] scummvm master -> fa9651d1bb2d2852c1146498fc8b55be823f9031
criezy
criezy at scummvm.org
Sun Aug 4 21:44:31 CEST 2019
This automated email contains information about 1 new commit which have been
pushed to the 'scummvm' repo located at https://github.com/scummvm/scummvm .
Summary:
fa9651d1bb IOS7: Make sure openURL is executed on the main thread
Commit: fa9651d1bb2d2852c1146498fc8b55be823f9031
https://github.com/scummvm/scummvm/commit/fa9651d1bb2d2852c1146498fc8b55be823f9031
Author: Thierry Crozat (criezy at scummvm.org)
Date: 2019-08-04T20:40:22+01:00
Commit Message:
IOS7: Make sure openURL is executed on the main thread
Changed paths:
backends/platform/ios7/ios7_osys_misc.mm
diff --git a/backends/platform/ios7/ios7_osys_misc.mm b/backends/platform/ios7/ios7_osys_misc.mm
index d7743f8..1f9232c 100644
--- a/backends/platform/ios7/ios7_osys_misc.mm
+++ b/backends/platform/ios7/ios7_osys_misc.mm
@@ -29,6 +29,14 @@
#include <SystemConfiguration/SCNetworkReachability.h>
#include "common/translation.h"
+static inline void execute_on_main_thread_async(void (^block)(void)) {
+ if ([NSThread currentThread] == [NSThread mainThread]) {
+ block();
+ } else {
+ dispatch_async(dispatch_get_main_queue(), block);
+ }
+}
+
Common::String OSystem_iOS7::getSystemLanguage() const {
NSString *locale = [[NSLocale currentLocale] localeIdentifier];
if (locale == nil)
@@ -79,11 +87,15 @@ bool OSystem_iOS7::openUrl(const Common::String &url) {
// The way to oipen a URL has changed in iOS 10. Check if the iOS 10 method is recognized
// and otherwise use the old method.
if ([application respondsToSelector:@selector(openURL:options:completionHandler:)]) {
- [application openURL:nsurl options:@{} completionHandler:nil];
- return true;
+ execute_on_main_thread_async(^ {
+ [application openURL:nsurl options:@{} completionHandler:nil];
+ });
} else {
- return [application openURL:nsurl];
+ execute_on_main_thread_async(^ {
+ [application openURL:nsurl];
+ });
}
+ return true;
}
bool OSystem_iOS7::isConnectionLimited() {
More information about the Scummvm-git-logs
mailing list