aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorLaszlo Agocs <laszlo.agocs@digia.com>2014-06-02 10:21:56 +0200
committerThe Qt Project <gerrit-noreply@qt-project.org>2014-06-03 10:34:35 +0200
commita9019adc013b711df6a9e2831b08306ea5591f31 (patch)
tree9dd4a299f8cb839575223e960a7da412d026f5fc
parent31f0e3aa00f80ba4a0f4a06cf2ca4121b86f41b7 (diff)
Destroy the FBO in QQuickWidget while a context is current
When creating the new FBO, it will try to restore the previous FBO after initialization. The internal tracking of the current FBO goes horribly wrong when a QOpenGLFramebufferObject is destroyed with no context current. In 5.4 the problem is solved by removing the tracking altogether. Here QQuickWidget is fixed to play nice and destroy QOpenGLFramebufferObject always with the context current. Task-number: QTBUG-39389 Change-Id: Ic6917696ed61f284d661a578c9c7f2e0673c412d Reviewed-by: Gunnar Sletta <gunnar.sletta@jollamobile.com>
-rw-r--r--src/quickwidgets/qquickwidget.cpp4
1 files changed, 2 insertions, 2 deletions
diff --git a/src/quickwidgets/qquickwidget.cpp b/src/quickwidgets/qquickwidget.cpp
index aea21af3a0..ec5d0bf8df 100644
--- a/src/quickwidgets/qquickwidget.cpp
+++ b/src/quickwidgets/qquickwidget.cpp
@@ -657,8 +657,6 @@ void QQuickWidget::createFramebufferObject()
{
Q_D(QQuickWidget);
- if (d->fbo)
- delete d->fbo;
QOpenGLContext *context = d->offscreenWindow->openglContext();
if (!context) {
@@ -672,6 +670,8 @@ void QQuickWidget::createFramebufferObject()
}
context->makeCurrent(d->offscreenSurface);
+
+ delete d->fbo;
d->fbo = new QOpenGLFramebufferObject(size() * window()->devicePixelRatio());
d->fbo->setAttachment(QOpenGLFramebufferObject::CombinedDepthStencil);
d->offscreenWindow->setRenderTarget(d->fbo);