From aecf3006bddb959795d03dd72d9c520e49713913 Mon Sep 17 00:00:00 2001 From: Samuel Nevala Date: Tue, 17 Nov 2015 09:32:20 +0200 Subject: winrt: Fix startup orientation handling Calling QWinRTScreen::onOrientationChanged in the class constructor can lead to situation where QWinRTScreen is expected to be fully constructed. Moving the onOrientationChanged call to QWinRTScreen::initialize ensures that QWinRTScreen is fully constructed when it is called. Task-Id: QTBUG-49470 Change-Id: I52748f33a9011dec3a172c1a74023cad15aae38a Reviewed-by: Andrew Knight --- src/plugins/platforms/winrt/qwinrtscreen.cpp | 6 ++---- 1 file changed, 2 insertions(+), 4 deletions(-) (limited to 'src/plugins/platforms') diff --git a/src/plugins/platforms/winrt/qwinrtscreen.cpp b/src/plugins/platforms/winrt/qwinrtscreen.cpp index 5bb29d3805..158917184c 100644 --- a/src/plugins/platforms/winrt/qwinrtscreen.cpp +++ b/src/plugins/platforms/winrt/qwinrtscreen.cpp @@ -507,11 +507,7 @@ QWinRTScreen::QWinRTScreen() hr = d->displayInformation->get_NativeOrientation(&displayOrientation); Q_ASSERT_SUCCEEDED(hr); d->nativeOrientation = static_cast(static_cast(qtOrientationsFromNative(displayOrientation))); - - // Set initial orientation & pixel density - onDpiChanged(Q_NULLPTR, Q_NULLPTR); d->orientation = d->nativeOrientation; - onOrientationChanged(Q_NULLPTR, Q_NULLPTR); ComPtr applicationViewStatics; hr = RoGetActivationFactory(HString::MakeReference(RuntimeClass_Windows_UI_ViewManagement_ApplicationView).Get(), @@ -757,6 +753,8 @@ void QWinRTScreen::initialize() Q_ASSERT_SUCCEEDED(hr); hr = d->displayInformation->add_DpiChanged(Callback(this, &QWinRTScreen::onDpiChanged).Get(), &d->displayTokens[&IDisplayInformation::remove_DpiChanged]); Q_ASSERT_SUCCEEDED(hr); + onDpiChanged(Q_NULLPTR, Q_NULLPTR); + onOrientationChanged(Q_NULLPTR, Q_NULLPTR); onVisibilityChanged(nullptr, nullptr); } -- cgit v1.2.3