element: NULL the lists of contexts in dispose()

If dispose() is called more than once, we may double unref the list of
GstContext's.

Part-of: <https://gitlab.freedesktop.org/gstreamer/gstreamer/-/merge_requests/877>
This commit is contained in:
Matthew Waters 2021-08-27 13:51:07 +10:00 committed by Tim-Philipp Müller
parent 867bfb840e
commit 0cc42f9dc6

View file

@ -3304,6 +3304,7 @@ gst_element_dispose (GObject * object)
gst_object_replace ((GstObject **) clock_p, NULL); gst_object_replace ((GstObject **) clock_p, NULL);
gst_object_replace ((GstObject **) bus_p, NULL); gst_object_replace ((GstObject **) bus_p, NULL);
g_list_free_full (element->contexts, (GDestroyNotify) gst_context_unref); g_list_free_full (element->contexts, (GDestroyNotify) gst_context_unref);
element->contexts = NULL;
GST_OBJECT_UNLOCK (element); GST_OBJECT_UNLOCK (element);
GST_CAT_INFO_OBJECT (GST_CAT_REFCOUNTING, element, "%p parent class dispose", GST_CAT_INFO_OBJECT (GST_CAT_REFCOUNTING, element, "%p parent class dispose",