mirror of
https://gitlab.freedesktop.org/pipewire/pipewire.git
synced 2025-11-03 09:01:54 -05:00
client: Fix unref of source and source-input
Make sure we unref the source-input when it is removed. When the source-input is removed, we should also unref the source. Do this by adding the source as data for the source-input and unreffing it when the source-input is freed.
This commit is contained in:
parent
3ad403ab13
commit
563f2a2726
2 changed files with 20 additions and 5 deletions
|
|
@ -371,6 +371,15 @@ on_input_socket_notify (GObject *gobject,
|
|||
gst_element_set_state (priv->pipeline, GST_STATE_READY);
|
||||
}
|
||||
|
||||
static void
|
||||
handle_remove_source_input (PinosSourceOutput *output,
|
||||
gpointer user_data)
|
||||
{
|
||||
PinosClientSourcePrivate *priv = user_data;
|
||||
|
||||
g_clear_pointer (&priv->input, g_object_unref);
|
||||
}
|
||||
|
||||
PinosSourceOutput *
|
||||
pinos_client_source_get_source_input (PinosClientSource *source,
|
||||
const gchar *client_path,
|
||||
|
|
@ -399,6 +408,11 @@ pinos_client_source_get_source_input (PinosClientSource *source,
|
|||
if (priv->input == NULL)
|
||||
return NULL;
|
||||
|
||||
g_signal_connect (priv->input,
|
||||
"remove",
|
||||
(GCallback) handle_remove_source_input,
|
||||
priv);
|
||||
|
||||
g_signal_connect (priv->input, "notify::socket", (GCallback) on_input_socket_notify, source);
|
||||
}
|
||||
return g_object_ref (priv->input);
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue