summaryrefslogtreecommitdiffstats
path: root/src/openglwidgets/qopenglwidget.cpp
diff options
context:
space:
mode:
authorLaszlo Agocs <laszlo.agocs@qt.io>2023-04-17 13:46:10 +0200
committerLaszlo Agocs <laszlo.agocs@qt.io>2023-04-18 13:23:48 +0200
commit2b908ba8f40924abded15681cf3b4af6056c3050 (patch)
treeac4c45ac1fd6d417ddbe71cf3d1967462b96a0ac /src/openglwidgets/qopenglwidget.cpp
parent99c8eca3f4364b1e062684dd71efc8c5c4b9059c (diff)
QOpenGLWidget: correct the lifetime of the wrapper texture objects
If the QOpenGLFramebufferObject (which owns the OpenGL texture object) is destroyed, the wrapper QRhiTexture must be destroyed too. This surfaced with WebAssembly for some reason, likely due to an event (most likely resize) sending pattern that is different from other platforms. Sending more resizes likely triggers another recreateFbos() call which, until now, did not correctly dropped the wrapper QRhiTextures so those continued to refer to the now-destroyed texture IDs. Pick-to: 6.5 6.4 Task-number: QTBUG-111304 Change-Id: Ieed9a11c5c28da0fee497107ebe88da9eb5f45a8 Reviewed-by: Morten Johan Sørvig <morten.sorvig@qt.io>
Diffstat (limited to 'src/openglwidgets/qopenglwidget.cpp')
-rw-r--r--src/openglwidgets/qopenglwidget.cpp4
1 files changed, 2 insertions, 2 deletions
diff --git a/src/openglwidgets/qopenglwidget.cpp b/src/openglwidgets/qopenglwidget.cpp
index d5f4e769d9..1415ba70e0 100644
--- a/src/openglwidgets/qopenglwidget.cpp
+++ b/src/openglwidgets/qopenglwidget.cpp
@@ -691,8 +691,6 @@ void QOpenGLWidgetPrivate::reset()
destroyFbos();
- resetRhiDependentResources();
-
if (initialized)
q->doneCurrent();
@@ -1016,6 +1014,8 @@ void QOpenGLWidgetPrivate::destroyFbos()
fbos[QOpenGLWidget::RightBuffer] = nullptr;
delete resolvedFbos[QOpenGLWidget::RightBuffer];
resolvedFbos[QOpenGLWidget::RightBuffer] = nullptr;
+
+ resetRhiDependentResources();
}
QImage QOpenGLWidgetPrivate::grabFramebuffer()