diff --git a/gst/gstinfo.c b/gst/gstinfo.c index 45f9fa19ea..16582e0136 100644 --- a/gst/gstinfo.c +++ b/gst/gstinfo.c @@ -1742,27 +1742,20 @@ _gst_debug_category_new (const gchar * name, guint color, return cat; } +#ifndef GST_REMOVE_DEPRECATED /** * gst_debug_category_free: * @category: #GstDebugCategory to free. * * Removes and frees the category and all associated resources. + * + * Deprecated: This function can easily cause memory corruption, don't use it. */ void gst_debug_category_free (GstDebugCategory * category) { - if (category == NULL) - return; - - /* remove from category list */ - g_mutex_lock (&__cat_mutex); - __categories = g_slist_remove (__categories, category); - g_mutex_unlock (&__cat_mutex); - - g_free ((gpointer) category->name); - g_free ((gpointer) category->description); - g_slice_free (GstDebugCategory, category); } +#endif /** * gst_debug_category_set_threshold: @@ -2304,10 +2297,12 @@ gst_debug_unset_threshold_for_name (const gchar * name) { } +#ifndef GST_REMOVE_DEPRECATED void gst_debug_category_free (GstDebugCategory * category) { } +#endif void gst_debug_category_set_threshold (GstDebugCategory * category, diff --git a/gst/gstinfo.h b/gst/gstinfo.h index 257564ab36..74d7406d71 100644 --- a/gst/gstinfo.h +++ b/gst/gstinfo.h @@ -446,8 +446,7 @@ void gst_debug_set_threshold_from_string (const gchar * list, gboole GST_API void gst_debug_unset_threshold_for_name (const gchar * name); - -GST_API +GST_DEPRECATED void gst_debug_category_free (GstDebugCategory * category); GST_API @@ -1492,7 +1491,9 @@ GST_TRACE (const char *format, ...) #define GST_DEBUG_CATEGORY_INIT(var,name,color,desc) G_STMT_START{ }G_STMT_END #define GST_DEBUG_CATEGORY_GET(var,name) G_STMT_START{ }G_STMT_END +#ifndef GST_DISABLE_DEPRECATED #define gst_debug_category_free(category) G_STMT_START{ }G_STMT_END +#endif #define gst_debug_category_set_threshold(category,level) G_STMT_START{ }G_STMT_END #define gst_debug_category_reset_threshold(category) G_STMT_START{ }G_STMT_END #define gst_debug_category_get_threshold(category) (GST_LEVEL_NONE) diff --git a/tests/check/gst/gstinfo.c b/tests/check/gst/gstinfo.c index 41d5cc52ce..b31c962e4c 100644 --- a/tests/check/gst/gstinfo.c +++ b/tests/check/gst/gstinfo.c @@ -480,9 +480,6 @@ GST_START_TEST (info_post_gst_init_category_registration) fail_unless_equals_int (gst_debug_category_get_threshold (cats[0xb10]), GST_LEVEL_LOG); } - - for (i = 0; i < G_N_ELEMENTS (cats); ++i) - gst_debug_category_free (cats[i]); } GST_END_TEST;