summaryrefslogtreecommitdiffstats
path: root/src/gui
diff options
context:
space:
mode:
authorLaszlo Agocs <laszlo.agocs@digia.com>2014-06-28 12:44:36 +0200
committerLaszlo Agocs <laszlo.agocs@digia.com>2014-06-30 10:35:33 +0200
commitba79f36cb1319a279068adb6d02a8993cbc62613 (patch)
treefd26f2a2f3b6fc07f4139420b7843995ec905c6d /src/gui
parent53c6c90c44812c981217e21247388b08358e8098 (diff)
Do not add QOffscreenSurface windows to the global list
QOffscreenSurface has to stay usable even after returning from app.exec(). Hence close()ing the underlying hidden window, that is used on platforms that do not provide real offscreen surfaces, is wrong. Normally all QWindows are closed (and thus destroy()'ed) when quitting the application, meaning the the offscreen surface cannot be made current anymore after returning from exec(). This is an unnecessary limitation and makes certain cleanup operations impossible. Task-number: QTBUG-39908 Change-Id: Iea1489378a18f29ff84ba8f13a6dad2d66d2b315 Reviewed-by: Gunnar Sletta <gunnar.sletta@jollamobile.com>
Diffstat (limited to 'src/gui')
-rw-r--r--src/gui/kernel/qoffscreensurface.cpp3
1 files changed, 3 insertions, 0 deletions
diff --git a/src/gui/kernel/qoffscreensurface.cpp b/src/gui/kernel/qoffscreensurface.cpp
index 1625909843..003e3a0cc9 100644
--- a/src/gui/kernel/qoffscreensurface.cpp
+++ b/src/gui/kernel/qoffscreensurface.cpp
@@ -171,6 +171,9 @@ void QOffscreenSurface::create()
if (QThread::currentThread() != qGuiApp->thread())
qWarning("Attempting to create QWindow-based QOffscreenSurface outside the gui thread. Expect failures.");
d->offscreenWindow = new QWindow(d->screen);
+ // Remove this window from the global list since we do not want it to be destroyed when closing the app.
+ // The QOffscreenSurface has to be usable even after exiting the event loop.
+ QGuiApplicationPrivate::window_list.removeOne(d->offscreenWindow);
d->offscreenWindow->setSurfaceType(QWindow::OpenGLSurface);
d->offscreenWindow->setFormat(d->requestedFormat);
d->offscreenWindow->setGeometry(0, 0, d->size.width(), d->size.height());