summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorVíctor Manuel Jáquez Leal <vjaquez@igalia.com>2013-12-07 19:32:58 +0100
committerTim-Philipp Müller <tim@centricular.com>2013-12-07 19:03:23 +0000
commit24a766a13b05a2d06bf9db24abf77eafe3f1f000 (patch)
treece91fe11cc7c5dbf916f423cf05fa9dde9f02113
parent53ae1b2c9c160a98a338adbb8a7ded0cad8eeebe (diff)
info: return existing category if a debug category is registered twice
If a category with the same name is found when creating a new one, the found category is returned instead of an invalid pointer. Fixes issue with gst-vaapi (which uses an internal copy of the codec parsers) caused by commit ccba9130. https://bugzilla.gnome.org/show_bug.cgi?id=720036
-rw-r--r--gst/gstinfo.c6
1 files changed, 4 insertions, 2 deletions
diff --git a/gst/gstinfo.c b/gst/gstinfo.c
index c9d8325bc..31c9e46d6 100644
--- a/gst/gstinfo.c
+++ b/gst/gstinfo.c
@@ -1509,7 +1509,7 @@ GstDebugCategory *
_gst_debug_category_new (const gchar * name, guint color,
const gchar * description)
{
- GstDebugCategory *cat;
+ GstDebugCategory *cat, *catfound;
g_return_val_if_fail (name != NULL, NULL);
@@ -1526,10 +1526,12 @@ _gst_debug_category_new (const gchar * name, guint color,
/* add to category list */
g_mutex_lock (&__cat_mutex);
- if (_gst_debug_get_category_locked (name)) {
+ catfound = _gst_debug_get_category_locked (name);
+ if (catfound) {
g_free ((gpointer) cat->name);
g_free ((gpointer) cat->description);
g_slice_free (GstDebugCategory, cat);
+ cat = catfound;
} else {
__categories = g_slist_prepend (__categories, cat);
}