OS7: Fix calling UI API on a background thread

This occured for example whenever showing the GMM in a game and
could cause various issues.
This commit is contained in:
Thierry Crozat 2021-08-22 19:41:17 +01:00
parent 952dc3d3e1
commit 0d8b9d272c

View File

@ -597,5 +597,13 @@ void OSystem_iOS7::setShowKeyboard(bool show) {
}
bool OSystem_iOS7::isKeyboardShown() const {
return [[iOS7AppDelegate iPhoneView] isKeyboardShown];
if ([NSThread currentThread] == [NSThread mainThread]) {
return [[iOS7AppDelegate iPhoneView] isKeyboardShown];
} else {
__block bool shown = false;
dispatch_sync(dispatch_get_main_queue(), ^{
shown = [[iOS7AppDelegate iPhoneView] isKeyboardShown];
});
return shown;
}
}