aboutsummaryrefslogtreecommitdiffstats
path: root/src/quick/scenegraph/qsgwindowsrenderloop.cpp
diff options
context:
space:
mode:
authorSimon Hausmann <simon.hausmann@theqtcompany.com>2014-12-09 15:09:20 +0100
committerSimon Hausmann <simon.hausmann@theqtcompany.com>2014-12-09 15:09:26 +0100
commitff466a1881435f927f5df9ce1e5eac07d5591904 (patch)
tree760e068743e6a8e1cc4ec63bb2f8e7dcef88b3e2 /src/quick/scenegraph/qsgwindowsrenderloop.cpp
parente04822f3c2a6b69b7d75e2039256aa2433c59dd2 (diff)
parent4a3f6e58b591f2fe2204f7cbc1efc8abb0aade74 (diff)
Merge remote-tracking branch 'origin/5.4' into dev
Conflicts: src/qml/jsruntime/qv4arraydata.cpp src/qml/jsruntime/qv4context_p.h src/qml/jsruntime/qv4globalobject.cpp src/qml/jsruntime/qv4internalclass.cpp src/quick/items/qquicktext_p.h src/quick/items/qquicktextedit_p.h src/quick/items/qquicktextinput_p.h Change-Id: If07e483e03197cb997ef47a9c647a479cdb09f4c
Diffstat (limited to 'src/quick/scenegraph/qsgwindowsrenderloop.cpp')
-rw-r--r--src/quick/scenegraph/qsgwindowsrenderloop.cpp21
1 files changed, 18 insertions, 3 deletions
diff --git a/src/quick/scenegraph/qsgwindowsrenderloop.cpp b/src/quick/scenegraph/qsgwindowsrenderloop.cpp
index 469cd1d21b..58d618a049 100644
--- a/src/quick/scenegraph/qsgwindowsrenderloop.cpp
+++ b/src/quick/scenegraph/qsgwindowsrenderloop.cpp
@@ -38,6 +38,7 @@
#include <QtGui/QScreen>
#include <QtGui/QGuiApplication>
+#include <QtGui/QOffscreenSurface>
#include <QtQuick/private/qsgcontext_p.h>
#include <QtQuick/private/qquickwindow_p.h>
@@ -214,15 +215,29 @@ void QSGWindowsRenderLoop::windowDestroyed(QQuickWindow *window)
hide(window);
QQuickWindowPrivate *d = QQuickWindowPrivate::get(window);
- if (m_gl)
- m_gl->makeCurrent(window);
+ bool current = false;
+ QScopedPointer<QOffscreenSurface> offscreenSurface;
+ if (m_gl) {
+ QSurface *surface = window;
+ // There may be no platform window if the window got closed.
+ if (!window->handle()) {
+ offscreenSurface.reset(new QOffscreenSurface);
+ offscreenSurface->setFormat(m_gl->format());
+ offscreenSurface->create();
+ surface = offscreenSurface.data();
+ }
+ current = m_gl->makeCurrent(surface);
+ }
+ if (Q_UNLIKELY(!current))
+ qCDebug(QSG_LOG_RENDERLOOP) << "cleanup without an OpenGL context";
+
d->cleanupNodesOnShutdown();
if (m_windows.size() == 0) {
d->context->invalidate();
QCoreApplication::sendPostedEvents(0, QEvent::DeferredDelete);
delete m_gl;
m_gl = 0;
- } else if (m_gl) {
+ } else if (m_gl && current) {
m_gl->doneCurrent();
}
}