summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorLaszlo Agocs <[email protected]>2023-04-17 13:46:10 +0200
committerQt Cherry-pick Bot <[email protected]>2023-04-19 17:12:09 +0000
commit6dc44dd1276d0667d92348baf5c20bba5ffe3c1e (patch)
tree6e49c60733fc9190f5526fde7213fc2de7d00c07
parent9fbc5f1c73e229536a811b5423161a8562f30a6c (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. Task-number: QTBUG-111304 Change-Id: Ieed9a11c5c28da0fee497107ebe88da9eb5f45a8 Reviewed-by: Morten Johan Sørvig <[email protected]> (cherry picked from commit 2b908ba8f40924abded15681cf3b4af6056c3050) Reviewed-by: Qt Cherry-pick Bot <[email protected]>
-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 bb41b91fbf6..1723b87c568 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()