caps: add cleanup priv function
authorGuillaume Desmottes <guillaume.desmottes@collabora.co.uk>
Tue, 26 Apr 2016 13:02:14 +0000 (16:02 +0300)
committerTim-Philipp Müller <tim@centricular.com>
Tue, 26 Apr 2016 13:29:08 +0000 (14:29 +0100)
Those are allocated in _priv_gst_caps_initialize() so it makes
sense to have a symetric cleanup functions called by gst_deinit().

https://bugzilla.gnome.org/show_bug.cgi?id=765606

gst/gst.c
gst/gst_private.h
gst/gstcaps.c

index ca99a47..43abeb1 100644 (file)
--- a/gst/gst.c
+++ b/gst/gst.c
@@ -992,6 +992,7 @@ gst_deinit (void)
   _priv_gst_registry_cleanup ();
   _priv_gst_allocator_cleanup ();
   _priv_gst_caps_features_cleanup ();
+  _priv_gst_caps_cleanup ();
 
 #ifndef GST_DISABLE_TRACE
   _priv_gst_alloc_trace_deinit ();
index efe55a1..25bed74 100644 (file)
@@ -130,6 +130,7 @@ G_GNUC_INTERNAL  void  _priv_gst_date_time_initialize (void);
 /* cleanup functions called from gst_deinit(). */
 G_GNUC_INTERNAL  void  _priv_gst_allocator_cleanup (void);
 G_GNUC_INTERNAL  void  _priv_gst_caps_features_cleanup (void);
+G_GNUC_INTERNAL  void  _priv_gst_caps_cleanup (void);
 
 /* Private registry functions */
 G_GNUC_INTERNAL
index e2145b3..c7d990b 100644 (file)
@@ -145,6 +145,15 @@ _priv_gst_caps_initialize (void)
       G_TYPE_STRING, gst_caps_transform_to_string);
 }
 
+void
+_priv_gst_caps_cleanup (void)
+{
+  gst_caps_unref (_gst_caps_any);
+  _gst_caps_any = NULL;
+  gst_caps_unref (_gst_caps_none);
+  _gst_caps_none = NULL;
+}
+
 GstCapsFeatures *
 __gst_caps_get_features_unchecked (const GstCaps * caps, guint idx)
 {