mirror of
https://gitlab.freedesktop.org/gstreamer/gstreamer.git
synced 2025-03-28 20:05:38 +00:00
info: Deprecate gst_debug_category_free()
And change it to do nothing at all. As debug categories don't use reference counting and they can be retrieved from anywhere at any time by name, it is fundamentally unsafe to free them at any point in time except for right before the end of the process. No code apart from a unit test seems to be currently using the function, so deprecate it and also change it to do nothing at all.
This commit is contained in:
parent
be56bd9aff
commit
04a7334140
3 changed files with 9 additions and 16 deletions
|
@ -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,
|
||||
|
|
|
@ -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)
|
||||
|
|
|
@ -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;
|
||||
|
|
Loading…
Reference in a new issue