mirror of
https://gitlab.freedesktop.org/gstreamer/gstreamer.git
synced 2025-04-26 06:54:49 +00:00
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:
parent
83ed1deda9
commit
22443cfb13
1 changed files with 4 additions and 4 deletions
|
@ -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;
|
||||||
}
|
}
|
||||||
|
|
Loading…
Reference in a new issue