mirror of
https://gitlab.freedesktop.org/pipewire/pipewire.git
synced 2026-01-07 11:08:41 -05:00
avoid deref
We can avoid a deref when we use container_of to get from the interface to the handle.
This commit is contained in:
parent
6b3bb79e70
commit
82414810e8
23 changed files with 433 additions and 385 deletions
|
|
@ -38,6 +38,7 @@
|
|||
|
||||
typedef struct {
|
||||
uint32_t node;
|
||||
uint32_t clock;
|
||||
} URI;
|
||||
|
||||
struct _PinosSpaALSAMonitorPrivate
|
||||
|
|
@ -105,7 +106,7 @@ add_item (PinosSpaALSAMonitor *this, SpaMonitorItem *item)
|
|||
SpaResult res;
|
||||
SpaHandle *handle;
|
||||
PinosNode *node;
|
||||
void *iface;
|
||||
void *node_iface, *clock_iface;
|
||||
PinosProperties *props = NULL;
|
||||
|
||||
g_debug ("alsa-monitor %p: add: \"%s\" (%s)", this, item->name, item->id);
|
||||
|
|
@ -119,8 +120,12 @@ add_item (PinosSpaALSAMonitor *this, SpaMonitorItem *item)
|
|||
g_error ("can't make factory instance: %d", res);
|
||||
return;
|
||||
}
|
||||
if ((res = spa_handle_get_interface (handle, priv->uri.node, &iface)) < 0) {
|
||||
g_error ("can't get MONITOR interface: %d", res);
|
||||
if ((res = spa_handle_get_interface (handle, priv->uri.node, &node_iface)) < 0) {
|
||||
g_error ("can't get NODE interface: %d", res);
|
||||
return;
|
||||
}
|
||||
if ((res = spa_handle_get_interface (handle, priv->uri.clock, &clock_iface)) < 0) {
|
||||
g_error ("can't get CLOCK interface: %d", res);
|
||||
return;
|
||||
}
|
||||
|
||||
|
|
@ -138,7 +143,8 @@ add_item (PinosSpaALSAMonitor *this, SpaMonitorItem *item)
|
|||
node = g_object_new (PINOS_TYPE_NODE,
|
||||
"daemon", priv->daemon,
|
||||
"name", item->factory->name,
|
||||
"node", iface,
|
||||
"node", node_iface,
|
||||
"clock", clock_iface,
|
||||
"properties", props,
|
||||
NULL);
|
||||
|
||||
|
|
@ -203,6 +209,7 @@ monitor_constructed (GObject * object)
|
|||
G_OBJECT_CLASS (pinos_spa_alsa_monitor_parent_class)->constructed (object);
|
||||
|
||||
priv->uri.node = spa_id_map_get_id (priv->daemon->map, SPA_NODE_URI);
|
||||
priv->uri.clock = spa_id_map_get_id (priv->daemon->map, SPA_CLOCK_URI);
|
||||
|
||||
while (TRUE) {
|
||||
SpaMonitorItem *item;
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue