From 4afb128d312a7f2a1d94e2becc5aaaec47326869 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Tor=20Arne=20Vestb=C3=B8?= Date: Mon, 22 Apr 2013 15:52:30 +0200 Subject: [PATCH] iOS: Don't try to set screen orientation before QApplication startup MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit 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 --- src/plugins/platforms/ios/qiosviewcontroller.mm | 4 ++++ 1 file changed, 4 insertions(+) diff --git a/src/plugins/platforms/ios/qiosviewcontroller.mm b/src/plugins/platforms/ios/qiosviewcontroller.mm index 404b2139661..9d3447a2e44 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;