mirror of
https://gitlab.freedesktop.org/pipewire/pipewire.git
synced 2025-11-01 22:58:50 -04:00
fix object refcounting some more
This commit is contained in:
parent
f6bb35cb98
commit
e632540983
5 changed files with 63 additions and 17 deletions
|
|
@ -231,11 +231,21 @@ client_release_source_output (PvSource *source, PvSourceOutput *output)
|
||||||
}
|
}
|
||||||
|
|
||||||
static void
|
static void
|
||||||
client_source_finalize (GObject * object)
|
client_source_dispose (GObject * object)
|
||||||
{
|
{
|
||||||
PvClientSourcePrivate *priv = PV_CLIENT_SOURCE (object)->priv;
|
PvClientSourcePrivate *priv = PV_CLIENT_SOURCE (object)->priv;
|
||||||
|
|
||||||
gst_element_set_state (priv->pipeline, GST_STATE_NULL);
|
gst_element_set_state (priv->pipeline, GST_STATE_NULL);
|
||||||
|
|
||||||
|
G_OBJECT_CLASS (pv_client_source_parent_class)->dispose (object);
|
||||||
|
}
|
||||||
|
|
||||||
|
static void
|
||||||
|
client_source_finalize (GObject * object)
|
||||||
|
{
|
||||||
|
PvClientSourcePrivate *priv = PV_CLIENT_SOURCE (object)->priv;
|
||||||
|
|
||||||
|
g_clear_object (&priv->input);
|
||||||
g_clear_object (&priv->filter);
|
g_clear_object (&priv->filter);
|
||||||
g_clear_object (&priv->sink);
|
g_clear_object (&priv->sink);
|
||||||
g_clear_object (&priv->src);
|
g_clear_object (&priv->src);
|
||||||
|
|
@ -305,7 +315,7 @@ pv_client_source_get_source_input (PvClientSource *source,
|
||||||
|
|
||||||
g_signal_connect (priv->input, "notify::socket", (GCallback) on_input_socket_notify, source);
|
g_signal_connect (priv->input, "notify::socket", (GCallback) on_input_socket_notify, source);
|
||||||
}
|
}
|
||||||
return priv->input;
|
return g_object_ref (priv->input);
|
||||||
}
|
}
|
||||||
|
|
||||||
static void
|
static void
|
||||||
|
|
@ -316,6 +326,7 @@ pv_client_source_class_init (PvClientSourceClass * klass)
|
||||||
|
|
||||||
g_type_class_add_private (klass, sizeof (PvClientSourcePrivate));
|
g_type_class_add_private (klass, sizeof (PvClientSourcePrivate));
|
||||||
|
|
||||||
|
gobject_class->dispose = client_source_dispose;
|
||||||
gobject_class->finalize = client_source_finalize;
|
gobject_class->finalize = client_source_finalize;
|
||||||
|
|
||||||
source_class->get_formats = client_get_formats;
|
source_class->get_formats = client_get_formats;
|
||||||
|
|
|
||||||
|
|
@ -254,9 +254,9 @@ handle_create_source_input (PvClient1 *interface,
|
||||||
g_signal_connect (input,
|
g_signal_connect (input,
|
||||||
"remove",
|
"remove",
|
||||||
(GCallback) handle_remove_source_output,
|
(GCallback) handle_remove_source_output,
|
||||||
client);
|
source);
|
||||||
|
|
||||||
g_object_set_data_full (G_OBJECT (client),
|
g_object_set_data_full (G_OBJECT (source),
|
||||||
source_input_path,
|
source_input_path,
|
||||||
input,
|
input,
|
||||||
g_object_unref);
|
g_object_unref);
|
||||||
|
|
@ -343,14 +343,21 @@ client_unregister_object (PvClient *client)
|
||||||
g_free (priv->object_path);
|
g_free (priv->object_path);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
static void
|
||||||
|
pv_client_dispose (GObject * object)
|
||||||
|
{
|
||||||
|
PvClient *client = PV_CLIENT (object);
|
||||||
|
|
||||||
|
client_unregister_object (client);
|
||||||
|
|
||||||
|
G_OBJECT_CLASS (pv_client_parent_class)->dispose (object);
|
||||||
|
}
|
||||||
static void
|
static void
|
||||||
pv_client_finalize (GObject * object)
|
pv_client_finalize (GObject * object)
|
||||||
{
|
{
|
||||||
PvClient *client = PV_CLIENT (object);
|
PvClient *client = PV_CLIENT (object);
|
||||||
PvClientPrivate *priv = client->priv;
|
PvClientPrivate *priv = client->priv;
|
||||||
|
|
||||||
client_unregister_object (client);
|
|
||||||
|
|
||||||
if (priv->properties)
|
if (priv->properties)
|
||||||
g_variant_unref (priv->properties);
|
g_variant_unref (priv->properties);
|
||||||
|
|
||||||
|
|
@ -375,10 +382,11 @@ pv_client_class_init (PvClientClass * klass)
|
||||||
|
|
||||||
g_type_class_add_private (klass, sizeof (PvClientPrivate));
|
g_type_class_add_private (klass, sizeof (PvClientPrivate));
|
||||||
|
|
||||||
|
gobject_class->constructed = pv_client_constructed;
|
||||||
|
gobject_class->dispose = pv_client_dispose;
|
||||||
gobject_class->finalize = pv_client_finalize;
|
gobject_class->finalize = pv_client_finalize;
|
||||||
gobject_class->set_property = pv_client_set_property;
|
gobject_class->set_property = pv_client_set_property;
|
||||||
gobject_class->get_property = pv_client_get_property;
|
gobject_class->get_property = pv_client_get_property;
|
||||||
gobject_class->constructed = pv_client_constructed;
|
|
||||||
|
|
||||||
g_object_class_install_property (gobject_class,
|
g_object_class_install_property (gobject_class,
|
||||||
PROP_DAEMON,
|
PROP_DAEMON,
|
||||||
|
|
|
||||||
|
|
@ -382,13 +382,22 @@ pv_daemon_find_source (PvDaemon *daemon,
|
||||||
|
|
||||||
G_DEFINE_TYPE (PvDaemon, pv_daemon, G_TYPE_OBJECT);
|
G_DEFINE_TYPE (PvDaemon, pv_daemon, G_TYPE_OBJECT);
|
||||||
|
|
||||||
|
static void
|
||||||
|
pv_daemon_dispose (GObject * object)
|
||||||
|
{
|
||||||
|
PvDaemon *daemon = PV_DAEMON_CAST (object);
|
||||||
|
|
||||||
|
pv_daemon_stop (daemon);
|
||||||
|
|
||||||
|
G_OBJECT_CLASS (pv_daemon_parent_class)->dispose (object);
|
||||||
|
}
|
||||||
|
|
||||||
static void
|
static void
|
||||||
pv_daemon_finalize (GObject * object)
|
pv_daemon_finalize (GObject * object)
|
||||||
{
|
{
|
||||||
PvDaemon *daemon = PV_DAEMON_CAST (object);
|
PvDaemon *daemon = PV_DAEMON_CAST (object);
|
||||||
PvDaemonPrivate *priv = daemon->priv;
|
PvDaemonPrivate *priv = daemon->priv;
|
||||||
|
|
||||||
pv_daemon_stop (daemon);
|
|
||||||
g_clear_object (&priv->server_manager);
|
g_clear_object (&priv->server_manager);
|
||||||
|
|
||||||
G_OBJECT_CLASS (pv_daemon_parent_class)->finalize (object);
|
G_OBJECT_CLASS (pv_daemon_parent_class)->finalize (object);
|
||||||
|
|
@ -401,6 +410,7 @@ pv_daemon_class_init (PvDaemonClass * klass)
|
||||||
|
|
||||||
g_type_class_add_private (klass, sizeof (PvDaemonPrivate));
|
g_type_class_add_private (klass, sizeof (PvDaemonPrivate));
|
||||||
|
|
||||||
|
gobject_class->dispose = pv_daemon_dispose;
|
||||||
gobject_class->finalize = pv_daemon_finalize;
|
gobject_class->finalize = pv_daemon_finalize;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
||||||
|
|
@ -211,15 +211,24 @@ no_format:
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
static void
|
||||||
|
clear_socket (PvSourceOutput *output)
|
||||||
|
{
|
||||||
|
PvSourceOutputPrivate *priv = output->priv;
|
||||||
|
|
||||||
|
g_clear_object (&priv->socket);
|
||||||
|
g_clear_pointer (&priv->requested_format, g_bytes_unref);
|
||||||
|
g_clear_pointer (&priv->format, g_bytes_unref);
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
static void
|
static void
|
||||||
stop_transfer (PvSourceOutput *output)
|
stop_transfer (PvSourceOutput *output)
|
||||||
{
|
{
|
||||||
PvSourceOutputPrivate *priv = output->priv;
|
PvSourceOutputPrivate *priv = output->priv;
|
||||||
|
|
||||||
if (priv->socket) {
|
if (priv->socket) {
|
||||||
g_clear_object (&priv->socket);
|
clear_socket (output);
|
||||||
g_clear_pointer (&priv->requested_format, g_bytes_unref);
|
|
||||||
g_clear_pointer (&priv->format, g_bytes_unref);
|
|
||||||
g_object_notify (G_OBJECT (output), "socket");
|
g_object_notify (G_OBJECT (output), "socket");
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
@ -276,8 +285,6 @@ output_unregister_object (PvSourceOutput *output)
|
||||||
{
|
{
|
||||||
PvSourceOutputPrivate *priv = output->priv;
|
PvSourceOutputPrivate *priv = output->priv;
|
||||||
|
|
||||||
stop_transfer (output);
|
|
||||||
|
|
||||||
pv_daemon_unexport (priv->daemon, priv->object_path);
|
pv_daemon_unexport (priv->daemon, priv->object_path);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
@ -286,6 +293,7 @@ pv_source_output_dispose (GObject * object)
|
||||||
{
|
{
|
||||||
PvSourceOutput *output = PV_SOURCE_OUTPUT (object);
|
PvSourceOutput *output = PV_SOURCE_OUTPUT (object);
|
||||||
|
|
||||||
|
clear_socket (output);
|
||||||
output_unregister_object (output);
|
output_unregister_object (output);
|
||||||
|
|
||||||
G_OBJECT_CLASS (pv_source_output_parent_class)->dispose (object);
|
G_OBJECT_CLASS (pv_source_output_parent_class)->dispose (object);
|
||||||
|
|
@ -324,11 +332,11 @@ pv_source_output_class_init (PvSourceOutputClass * klass)
|
||||||
|
|
||||||
g_type_class_add_private (klass, sizeof (PvSourceOutputPrivate));
|
g_type_class_add_private (klass, sizeof (PvSourceOutputPrivate));
|
||||||
|
|
||||||
|
gobject_class->constructed = pv_source_output_constructed;
|
||||||
gobject_class->dispose = pv_source_output_dispose;
|
gobject_class->dispose = pv_source_output_dispose;
|
||||||
gobject_class->finalize = pv_source_output_finalize;
|
gobject_class->finalize = pv_source_output_finalize;
|
||||||
gobject_class->set_property = pv_source_output_set_property;
|
gobject_class->set_property = pv_source_output_set_property;
|
||||||
gobject_class->get_property = pv_source_output_get_property;
|
gobject_class->get_property = pv_source_output_get_property;
|
||||||
gobject_class->constructed = pv_source_output_constructed;
|
|
||||||
|
|
||||||
g_object_class_install_property (gobject_class,
|
g_object_class_install_property (gobject_class,
|
||||||
PROP_DAEMON,
|
PROP_DAEMON,
|
||||||
|
|
|
||||||
|
|
@ -171,14 +171,22 @@ pv_source_constructed (GObject * object)
|
||||||
G_OBJECT_CLASS (pv_source_parent_class)->constructed (object);
|
G_OBJECT_CLASS (pv_source_parent_class)->constructed (object);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
static void
|
||||||
|
pv_source_dispose (GObject * object)
|
||||||
|
{
|
||||||
|
PvSource *source = PV_SOURCE (object);
|
||||||
|
|
||||||
|
source_unregister_object (source);
|
||||||
|
|
||||||
|
G_OBJECT_CLASS (pv_source_parent_class)->dispose (object);
|
||||||
|
}
|
||||||
|
|
||||||
static void
|
static void
|
||||||
pv_source_finalize (GObject * object)
|
pv_source_finalize (GObject * object)
|
||||||
{
|
{
|
||||||
PvSource *source = PV_SOURCE (object);
|
PvSource *source = PV_SOURCE (object);
|
||||||
PvSourcePrivate *priv = source->priv;
|
PvSourcePrivate *priv = source->priv;
|
||||||
|
|
||||||
source_unregister_object (source);
|
|
||||||
|
|
||||||
g_free (priv->object_path);
|
g_free (priv->object_path);
|
||||||
g_free (priv->name);
|
g_free (priv->name);
|
||||||
if (priv->properties)
|
if (priv->properties)
|
||||||
|
|
@ -239,8 +247,9 @@ pv_source_class_init (PvSourceClass * klass)
|
||||||
|
|
||||||
g_type_class_add_private (klass, sizeof (PvSourcePrivate));
|
g_type_class_add_private (klass, sizeof (PvSourcePrivate));
|
||||||
|
|
||||||
gobject_class->finalize = pv_source_finalize;
|
|
||||||
gobject_class->constructed = pv_source_constructed;
|
gobject_class->constructed = pv_source_constructed;
|
||||||
|
gobject_class->dispose = pv_source_dispose;
|
||||||
|
gobject_class->finalize = pv_source_finalize;
|
||||||
gobject_class->set_property = pv_source_set_property;
|
gobject_class->set_property = pv_source_set_property;
|
||||||
gobject_class->get_property = pv_source_get_property;
|
gobject_class->get_property = pv_source_get_property;
|
||||||
|
|
||||||
|
|
|
||||||
Loading…
Add table
Add a link
Reference in a new issue