track client resources

This commit is contained in:
Wim Taymans 2016-11-15 17:06:09 +01:00
parent 0d21d633c9
commit b6ad45bb74
14 changed files with 253 additions and 92 deletions

View file

@ -1274,7 +1274,6 @@ proxy_clear (SpaProxy *this)
/**
* pinos_client_node_new:
* @daemon: a #PinosDaemon
* @client: the client owner
* @name: a name
* @properties: extra properties
*
@ -1284,7 +1283,6 @@ proxy_clear (SpaProxy *this)
*/
PinosClientNode *
pinos_client_node_new (PinosCore *core,
PinosClient *client,
const gchar *name,
PinosProperties *properties)
{
@ -1323,16 +1321,15 @@ pinos_client_node_new (PinosCore *core,
return this;
}
void
pinos_client_node_destroy (PinosClientNode * this)
static void
on_node_remove (PinosNode *node,
gpointer data,
SpaResult res)
{
PinosClientNode *this = data;
PinosClientNodeImpl *impl = SPA_CONTAINER_OF (this, PinosClientNodeImpl, this);
pinos_log_debug ("client-node %p: destroy", impl);
pinos_signal_emit (&this->destroy_signal, this);
pinos_node_destroy (this->node);
pinos_log_debug ("client-node %p: finalize", node);
proxy_clear (&impl->proxy);
if (impl->ctrl_fd != -1)
@ -1342,6 +1339,27 @@ pinos_client_node_destroy (PinosClientNode * this)
free (impl);
}
SpaResult
pinos_client_node_destroy (PinosClientNode * this)
{
PinosClientNodeImpl *impl = SPA_CONTAINER_OF (this, PinosClientNodeImpl, this);
SpaResult res;
pinos_log_debug ("client-node %p: destroy", impl);
pinos_signal_emit (&this->destroy_signal, this);
res = pinos_node_destroy (this->node);
pinos_main_loop_defer (this->node->core->main_loop,
this->node,
res,
(PinosDeferFunc) on_node_remove,
this);
return res;
}
/**
* pinos_client_node_get_ctrl_socket:
* @node: a #PinosClientNode