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>bb10
parent
c36a5aee70
commit
ebae7fc426
|
|
@ -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)
|
||||
|
|
|
|||
Loading…
Reference in New Issue