Skip to content

Commit

Permalink
qtitem: don't potentially leak a large number of buffers
Browse files Browse the repository at this point in the history
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>
  • Loading branch information
ystreet committed Jun 3, 2021
1 parent be83a52 commit fbf60a6
Showing 1 changed file with 11 additions and 0 deletions.
11 changes: 11 additions & 0 deletions ext/qt/qtitem.cc
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand All @@ -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);
Expand Down

0 comments on commit fbf60a6

Please sign in to comment.