v4l2: don't abuse the class lock

Use a new static lock to protect the probed device list instead of the object
class lock.
This commit is contained in:
Wim Taymans 2010-12-07 11:40:58 +01:00
parent 83ed1deda9
commit 22443cfb13

View file

@ -59,21 +59,21 @@ enum
V4L2_STD_OBJECT_PROPS, V4L2_STD_OBJECT_PROPS,
}; };
G_LOCK_DEFINE_STATIC (probe_lock);
const GList * const GList *
gst_v4l2_probe_get_properties (GstPropertyProbe * probe) gst_v4l2_probe_get_properties (GstPropertyProbe * probe)
{ {
GObjectClass *klass = G_OBJECT_GET_CLASS (probe); GObjectClass *klass = G_OBJECT_GET_CLASS (probe);
static GList *list = NULL; static GList *list = NULL;
/* well, not perfect, but better than no locking at all. G_LOCK (probe_lock);
* In the worst case we leak a list node, so who cares? */
GST_CLASS_LOCK (GST_OBJECT_CLASS (klass));
if (!list) { if (!list) {
list = g_list_append (NULL, g_object_class_find_property (klass, "device")); list = g_list_append (NULL, g_object_class_find_property (klass, "device"));
} }
GST_CLASS_UNLOCK (GST_OBJECT_CLASS (klass)); G_UNLOCK (probe_lock);
return list; return list;
} }