mirror of
https://gitlab.freedesktop.org/gstreamer/gstreamer.git
synced 2025-01-10 17:35:59 +00:00
v4l2codecs: Fix segfault when destroying non-detached allocator
The GstV4l2CodecAllocator dispose function clears `self->decoder` but the finalize function then tries to use it if the allocator has no been detached yet. Fix by detaching in the dispose function before we clear `self->decoder`. Part-of: <https://gitlab.freedesktop.org/gstreamer/gstreamer/-/merge_requests/1220>
This commit is contained in:
parent
1aab0e49f6
commit
3846b0563a
1 changed files with 4 additions and 4 deletions
|
@ -213,7 +213,10 @@ gst_v4l2_codec_allocator_dispose (GObject * object)
|
|||
while ((buf = g_queue_pop_head (&self->pool)))
|
||||
gst_v4l2_codec_buffer_free (buf);
|
||||
|
||||
gst_clear_object (&self->decoder);
|
||||
if (self->decoder) {
|
||||
gst_v4l2_codec_allocator_detach (self);
|
||||
gst_clear_object (&self->decoder);
|
||||
}
|
||||
|
||||
G_OBJECT_CLASS (gst_v4l2_codec_allocator_parent_class)->dispose (object);
|
||||
}
|
||||
|
@ -223,9 +226,6 @@ gst_v4l2_codec_allocator_finalize (GObject * object)
|
|||
{
|
||||
GstV4l2CodecAllocator *self = GST_V4L2_CODEC_ALLOCATOR (object);
|
||||
|
||||
if (!self->detached)
|
||||
gst_v4l2_decoder_request_buffers (self->decoder, self->direction, 0);
|
||||
|
||||
g_cond_clear (&self->buffer_cond);
|
||||
|
||||
G_OBJECT_CLASS (gst_v4l2_codec_allocator_parent_class)->finalize (object);
|
||||
|
|
Loading…
Reference in a new issue