diff options
author | Matthew Waters <matthew@centricular.com> | 2021-06-03 20:33:45 +1000 |
---|---|---|
committer | Tim-Philipp Müller <tim@centricular.com> | 2021-06-03 23:56:00 +0100 |
commit | beba0254d8aa60f5f03eedacaec2955a6c896c31 (patch) | |
tree | 0157bee917e8eb3f37e632eda8f2670d19b1e190 | |
parent | 41c100bc8e53885527c900d811a00087f2d42079 (diff) | |
download | gstreamer-plugins-good-beba0254d8aa60f5f03eedacaec2955a6c896c31.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/1005>
-rw-r--r-- | ext/qt/qtitem.cc | 11 |
1 files changed, 11 insertions, 0 deletions
diff --git a/ext/qt/qtitem.cc b/ext/qt/qtitem.cc index bc99639b4..8384a629a 100644 --- a/ext/qt/qtitem.cc +++ b/ext/qt/qtitem.cc @@ -133,6 +133,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 @@ -149,6 +151,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); |