summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorMäättä Antti <antti.maatta@qt.io>2017-07-28 13:45:29 +0300
committerAntti Määttä <antti.maatta@qt.io>2017-08-08 07:57:31 +0000
commitebae7fc4264b393436450a6355df38eb97770f9f (patch)
treee58aa5c367a5862f373676d5caddf3b756fc8797
parentc36a5aee70d0d4dec9062739cde9f83139900d92 (diff)
Fix reset with qoffscreensurface destruction with multimonitor support
The qoffscreensurface::setScreen crashes in create if application is closing. This happens in multimonitor setup when one of the screens is already destroyed and qoffscreensurface handles the screenDestroyed signal. In this case the QGuiApplication::primaryScreen returns non-null surface and selects the codepath that recreates the surface. The create function calls the qGuiApp->thread function, which crashes since the application instance has already been set to nullptr. Prevent this in qoffscreensurface by checking the application instance in the setScreen function. Task-number: QTBUG-62222 Change-Id: Ibb11a270c23a39e66009b45ab83dd7d47d5ccb1f Reviewed-by: Janne Koskinen <janne.p.koskinen@qt.io> Reviewed-by: Laszlo Agocs <laszlo.agocs@qt.io>
-rw-r--r--src/gui/kernel/qoffscreensurface.cpp2
1 files changed, 1 insertions, 1 deletions
diff --git a/src/gui/kernel/qoffscreensurface.cpp b/src/gui/kernel/qoffscreensurface.cpp
index 307bc5e62f..4d79db8ab2 100644
--- a/src/gui/kernel/qoffscreensurface.cpp
+++ b/src/gui/kernel/qoffscreensurface.cpp
@@ -317,7 +317,7 @@ void QOffscreenSurface::setScreen(QScreen *newScreen)
{
Q_D(QOffscreenSurface);
if (!newScreen)
- newScreen = QGuiApplication::primaryScreen();
+ newScreen = QCoreApplication::instance() ? QGuiApplication::primaryScreen() : nullptr;
if (newScreen != d->screen) {
const bool wasCreated = d->platformOffscreenSurface != 0 || d->offscreenWindow != 0;
if (wasCreated)