mirror of
https://gitlab.freedesktop.org/gstreamer/gstreamer.git
synced 2025-04-26 05:16:13 +00:00
alsaprobe: don't abuse the object class lock
don't abuse the class lock but use a new static lock for protecting the probed list of devices.
This commit is contained in:
parent
5b4959d5d1
commit
f355419679
1 changed files with 4 additions and 4 deletions
|
@ -26,15 +26,15 @@
|
||||||
#include "gstalsadeviceprobe.h"
|
#include "gstalsadeviceprobe.h"
|
||||||
#include "gst/interfaces/propertyprobe.h"
|
#include "gst/interfaces/propertyprobe.h"
|
||||||
|
|
||||||
|
G_LOCK_DEFINE_STATIC (probe_lock);
|
||||||
|
|
||||||
static const GList *
|
static const GList *
|
||||||
gst_alsa_device_property_probe_get_properties (GstPropertyProbe * probe)
|
gst_alsa_device_property_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) {
|
||||||
GParamSpec *pspec;
|
GParamSpec *pspec;
|
||||||
|
@ -43,7 +43,7 @@ gst_alsa_device_property_probe_get_properties (GstPropertyProbe * probe)
|
||||||
list = g_list_append (NULL, pspec);
|
list = g_list_append (NULL, pspec);
|
||||||
}
|
}
|
||||||
|
|
||||||
GST_CLASS_UNLOCK (GST_OBJECT_CLASS (klass));
|
G_UNLOCK (probe_lock);
|
||||||
|
|
||||||
return list;
|
return list;
|
||||||
}
|
}
|
||||||
|
|
Loading…
Reference in a new issue