summaryrefslogtreecommitdiff
path: root/ext
diff options
context:
space:
mode:
authorMatthew Waters <matthew@centricular.com>2021-06-03 20:33:45 +1000
committerMatthew Waters <matthew@centricular.com>2021-06-03 20:33:45 +1000
commitfbf60a61a005f13b9d5e6b3e445e2d40723663c4 (patch)
tree2324b9fca50f6ef3b0c0819340cd1b6e3807c4d5 /ext
parentbe83a52db953850ffccbb3868dd660e2aa129e5f (diff)
downloadgstreamer-plugins-good-fbf60a61a005f13b9d5e6b3e445e2d40723663c4.tar.gz
qtitem: don't potentially leak a large number of buffers
The only other place where these queued buffers are removed, is in setCaps() but that is not called at all on shutdown so this list of buffers could not be removed. Part-of: <https://gitlab.freedesktop.org/gstreamer/gst-plugins-good/-/merge_requests/1004>
Diffstat (limited to 'ext')
-rw-r--r--ext/qt/qtitem.cc11
1 files changed, 11 insertions, 0 deletions
diff --git a/ext/qt/qtitem.cc b/ext/qt/qtitem.cc
index 726296da3..1b0ba5a6a 100644
--- a/ext/qt/qtitem.cc
+++ b/ext/qt/qtitem.cc
@@ -141,6 +141,8 @@ QtGLVideoItem::QtGLVideoItem()
QtGLVideoItem::~QtGLVideoItem()
{
+ GstBuffer *tmp_buffer;
+
/* Before destroying the priv info, make sure
* no qmlglsink's will call in again, and that
* any ongoing calls are done by invalidating the proxy
@@ -157,6 +159,15 @@ QtGLVideoItem::~QtGLVideoItem()
if (this->priv->display)
gst_object_unref(this->priv->display);
+ while ((tmp_buffer = (GstBuffer*) g_queue_pop_head (&this->priv->potentially_unbound_buffers))) {
+ GST_TRACE ("old buffer %p should be unbound now, unreffing", tmp_buffer);
+ gst_buffer_unref (tmp_buffer);
+ }
+ while ((tmp_buffer = (GstBuffer*) g_queue_pop_head (&this->priv->bound_buffers))) {
+ GST_TRACE ("old buffer %p should be unbound now, unreffing", tmp_buffer);
+ gst_buffer_unref (tmp_buffer);
+ }
+
gst_buffer_replace (&this->priv->buffer, NULL);
gst_caps_replace (&this->priv->caps, NULL);