From a9019adc013b711df6a9e2831b08306ea5591f31 Mon Sep 17 00:00:00 2001 From: Laszlo Agocs Date: Mon, 2 Jun 2014 10:21:56 +0200 Subject: 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 --- src/quickwidgets/qquickwidget.cpp | 4 ++-- 1 file 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); -- cgit v1.2.3