qml6: fix a leak of the wrapped QSGTextures
authorMatthew Waters <matthew@centricular.com>
Wed, 7 Feb 2024 04:04:53 +0000 (15:04 +1100)
committerTim-Philipp Müller <tim@centricular.com>
Thu, 22 Feb 2024 10:24:24 +0000 (10:24 +0000)
Part-of: <https://gitlab.freedesktop.org/gstreamer/gstreamer/-/merge_requests/6160>

subprojects/gst-plugins-good/ext/qt6/gstqsg6material.cc

index bf508410978e51ea44e943647d37e553945126b2..8261e4e2153523fb65f1856478c3ab855ad1b861 100644 (file)
@@ -222,6 +222,10 @@ GstQSGTexture::GstQSGTexture(QRhiTexture * texture)
 
 GstQSGTexture::~GstQSGTexture()
 {
+  if (m_texture) {
+    delete m_texture;
+    m_texture = nullptr;
+  }
 }
 
 qint64
@@ -291,6 +295,12 @@ GstQSGMaterialShader::GstQSGMaterialShader(GstVideoFormat v_format)
 
 GstQSGMaterialShader::~GstQSGMaterialShader()
 {
+  for (int i = 0; i < 4; i++) {
+    if (m_textures[i]) {
+      delete m_textures[i];
+      m_textures[i] = nullptr;
+    }
+  }
 }
 
 bool