mirror of
https://gitlab.freedesktop.org/gstreamer/gstreamer.git
synced 2024-12-23 00:36:51 +00:00
qtdemux: Use safer clearing functions in dispose()
In theory, `dispose()` functions should be idempotent and should be prepared not to crash or cause a double-free if an unref done from inside caused a recursive call to `dispose()` of the same object. https://developer.gnome.org/gobject/stable/howto-gobject-destruction.html This patch modifies the `dispose()` method to honor these constraints. Since the double `dispose()` call won't actually occur in qtdemux (there is no cycle detection mechanism that could invoke it to work that way), this is more of a code cleanup than a user-facing problem fix. Part-of: <https://gitlab.freedesktop.org/gstreamer/gstreamer/-/merge_requests/3822>
This commit is contained in:
parent
4051581ed8
commit
8a6023a38a
1 changed files with 9 additions and 13 deletions
|
@ -469,6 +469,11 @@ gst_qtdemux_finalize (GObject * object)
|
|||
GstQTDemux *qtdemux = GST_QTDEMUX (object);
|
||||
|
||||
g_free (qtdemux->redirect_location);
|
||||
g_free (qtdemux->cenc_aux_info_sizes);
|
||||
g_mutex_clear (&qtdemux->expose_lock);
|
||||
|
||||
g_ptr_array_free (qtdemux->active_streams, TRUE);
|
||||
g_ptr_array_free (qtdemux->old_streams, TRUE);
|
||||
|
||||
G_OBJECT_CLASS (parent_class)->finalize (object);
|
||||
}
|
||||
|
@ -478,22 +483,13 @@ gst_qtdemux_dispose (GObject * object)
|
|||
{
|
||||
GstQTDemux *qtdemux = GST_QTDEMUX (object);
|
||||
|
||||
if (qtdemux->adapter) {
|
||||
g_object_unref (G_OBJECT (qtdemux->adapter));
|
||||
qtdemux->adapter = NULL;
|
||||
}
|
||||
gst_tag_list_unref (qtdemux->tag_list);
|
||||
gst_flow_combiner_free (qtdemux->flowcombiner);
|
||||
g_clear_object (&qtdemux->adapter);
|
||||
gst_clear_tag_list (&qtdemux->tag_list);
|
||||
g_clear_pointer (&qtdemux->flowcombiner, gst_flow_combiner_unref);
|
||||
|
||||
g_queue_clear_full (&qtdemux->protection_event_queue,
|
||||
(GDestroyNotify) gst_event_unref);
|
||||
|
||||
g_free (qtdemux->cenc_aux_info_sizes);
|
||||
qtdemux->cenc_aux_info_sizes = NULL;
|
||||
g_mutex_clear (&qtdemux->expose_lock);
|
||||
|
||||
g_ptr_array_free (qtdemux->active_streams, TRUE);
|
||||
g_ptr_array_free (qtdemux->old_streams, TRUE);
|
||||
|
||||
G_OBJECT_CLASS (parent_class)->dispose (object);
|
||||
}
|
||||
|
||||
|
|
Loading…
Reference in a new issue