aboutsummaryrefslogtreecommitdiff
path: root/backends/platform
diff options
context:
space:
mode:
authorJonny Bergström2018-09-13 22:57:19 +0900
committerD G Turner2018-09-14 02:32:25 +0100
commit58f3aac49ece050ddd3f5a51b4033a1bcadc08a7 (patch)
tree9b6bc4183f8da14c5210114bef09d1353665344b /backends/platform
parent4034497edd89a80f2e6aac6965b4d52c9d0cf971 (diff)
downloadscummvm-rg350-58f3aac49ece050ddd3f5a51b4033a1bcadc08a7.tar.gz
scummvm-rg350-58f3aac49ece050ddd3f5a51b4033a1bcadc08a7.tar.bz2
scummvm-rg350-58f3aac49ece050ddd3f5a51b4033a1bcadc08a7.zip
IOS: Only change idle timer from main thread.
This prevents various runtime warnings i.e. "Main Thread Checker: UI API called on a background thread: -[UIApplication setIdleTimerDisabled:] ..."
Diffstat (limited to 'backends/platform')
-rw-r--r--backends/platform/ios7/ios7_osys_video.mm8
1 files changed, 6 insertions, 2 deletions
diff --git a/backends/platform/ios7/ios7_osys_video.mm b/backends/platform/ios7/ios7_osys_video.mm
index 730715d2a1..3196f88822 100644
--- a/backends/platform/ios7/ios7_osys_video.mm
+++ b/backends/platform/ios7/ios7_osys_video.mm
@@ -64,13 +64,17 @@ void OSystem_iOS7::fatalError() {
void OSystem_iOS7::engineInit() {
EventsBaseBackend::engineInit();
// Prevent the device going to sleep during game play (and in particular cut scenes)
- [[UIApplication sharedApplication] setIdleTimerDisabled:YES];
+ dispatch_async(dispatch_get_main_queue(), ^{
+ [[UIApplication sharedApplication] setIdleTimerDisabled:YES];
+ });
}
void OSystem_iOS7::engineDone() {
EventsBaseBackend::engineDone();
// Allow the device going to sleep if idle while in the Launcher
- [[UIApplication sharedApplication] setIdleTimerDisabled:NO];
+ dispatch_async(dispatch_get_main_queue(), ^{
+ [[UIApplication sharedApplication] setIdleTimerDisabled:NO];
+ });
}
void OSystem_iOS7::initVideoContext() {