-
Bug
-
Resolution: Done
-
P1: Critical
-
5.12.0
-
None
-
-
230921a7f00d368551ecf5d6457765eae03e9325 (qt/qtbase/5.12)
I have an i.MX6 board with only egl backend. The application automatically start on boot and calls showMaximized() on a QQuickView. When no display is connected this crashes with a backtrace like this:
#0 0xb632b534 in QScreen::handle() const () from /usr/lib/libQt5Gui.so.5 #1 0xb633a290 in QHighDpiScaling::updateHighDpiScaling() () from /usr/lib/libQt5Gui.so.5
This patch solves it for the moment, although I'm not sure if this is the right way to handle it:
--- a/qtbase/src/gui/kernel/qhighdpiscaling.cpp
+++ b/qtbase/src/gui/kernel/qhighdpiscaling.cpp
@@ -313,7 +313,10 @@ void QHighDpiScaling::updateHighDpiScaling()
}
m_active = m_globalScalingActive || m_screenFactorSet || m_pixelDensityScalingActive;
- QPlatformScreen *primaryScreen = QGuiApplication::primaryScreen()->handle();
+ auto ps = QGuiApplication::primaryScreen();
+ if (ps == nullptr)
+ return;
+ QPlatformScreen *primaryScreen = ps->handle();
qreal sf = screenSubfactor(primaryScreen);
QDpi primaryDpi = primaryScreen->logicalDpi();
m_logicalDpi = QDpi(primaryDpi.first / sf, primaryDpi.second / sf);