mirror of
https://gitlab.freedesktop.org/gstreamer/gstreamer.git
synced 2024-11-18 07:47:17 +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,
|
||||
};
|
||||
|
||||
G_LOCK_DEFINE_STATIC (probe_lock);
|
||||
|
||||
const GList *
|
||||
gst_v4l2_probe_get_properties (GstPropertyProbe * probe)
|
||||
{
|
||||
GObjectClass *klass = G_OBJECT_GET_CLASS (probe);
|
||||
static GList *list = NULL;
|
||||
|
||||
/* well, not perfect, but better than no locking at all.
|
||||
* In the worst case we leak a list node, so who cares? */
|
||||
GST_CLASS_LOCK (GST_OBJECT_CLASS (klass));
|
||||
G_LOCK (probe_lock);
|
||||
|
||||
if (!list) {
|
||||
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;
|
||||
}
|
||||
|
|
Loading…
Reference in a new issue