summaryrefslogtreecommitdiffstats
path: root/src
diff options
context:
space:
mode:
authorTor Arne Vestbø <tor.arne.vestbo@digia.com>2013-04-22 15:52:30 +0200
committerThe Qt Project <gerrit-noreply@qt-project.org>2013-04-24 13:36:53 +0200
commit4afb128d312a7f2a1d94e2becc5aaaec47326869 (patch)
treed6edd9639ad4c8d7265b25658a3acb5d3b22b3e8 /src
parentded4613ae43842d4b960137843eb83a7472adc65 (diff)
iOS: Don't try to set screen orientation before QApplication startup
We create our QIOSViewController in didFinishLaunchingWithOptions, and schedule a timer to run the user's main. If the device is placed in landscape orientation at startup, we will receive a willRotateToInterfaceOrientation message before the timer is triggered to run the user's main, which means we do not yet have a QApplication. To fix this crash we exit early, but we might have to store the new orientation for later, and make sure the initial QScreen is then created with the correct orientation. Change-Id: I0cc02f0d36b992d190736e98858dc7d002d595b7 Reviewed-by: Morten Johan Sørvig <morten.sorvig@digia.com>
Diffstat (limited to 'src')
-rw-r--r--src/plugins/platforms/ios/qiosviewcontroller.mm4
1 files changed, 4 insertions, 0 deletions
diff --git a/src/plugins/platforms/ios/qiosviewcontroller.mm b/src/plugins/platforms/ios/qiosviewcontroller.mm
index 404b213966..9d3447a2e4 100644
--- a/src/plugins/platforms/ios/qiosviewcontroller.mm
+++ b/src/plugins/platforms/ios/qiosviewcontroller.mm
@@ -78,6 +78,10 @@
- (void)willRotateToInterfaceOrientation:(UIInterfaceOrientation)toInterfaceOrientation duration:(NSTimeInterval)duration
{
Q_UNUSED(duration);
+
+ if (!QCoreApplication::instance())
+ return; // FIXME: Store orientation for later (?)
+
Qt::ScreenOrientation orientation = toQtScreenOrientation(UIDeviceOrientation(toInterfaceOrientation));
if (orientation == -1)
return;