mirror of
https://gitlab.freedesktop.org/pipewire/pipewire.git
synced 2025-11-03 09:01:54 -05:00
remove hooks from objects
Remove the hooks we installed on objects in the destroy/free event or before calling _destroy. This is not really needed but it is a nice thing to do because it calls the hook removed callbacks.
This commit is contained in:
parent
6317bc4deb
commit
1570e62635
19 changed files with 109 additions and 27 deletions
|
|
@ -315,6 +315,8 @@ static void client_free(void *data)
|
|||
pw_log_debug(NAME" %p: free", this);
|
||||
spa_list_remove(&this->protocol_link);
|
||||
|
||||
spa_hook_remove(&this->client_listener);
|
||||
|
||||
if (this->source)
|
||||
pw_loop_destroy_source(client->context->main_loop, this->source);
|
||||
if (this->connection)
|
||||
|
|
@ -329,6 +331,12 @@ static const struct pw_impl_client_events client_events = {
|
|||
.busy_changed = client_busy_changed,
|
||||
};
|
||||
|
||||
static void on_server_connection_destroy(void *data)
|
||||
{
|
||||
struct client_data *this = data;
|
||||
spa_hook_remove(&this->conn_listener);
|
||||
}
|
||||
|
||||
static void on_start(void *data, uint32_t version)
|
||||
{
|
||||
struct client_data *this = data;
|
||||
|
|
@ -351,6 +359,7 @@ static void on_start(void *data, uint32_t version)
|
|||
|
||||
static const struct pw_protocol_native_connection_events server_conn_events = {
|
||||
PW_VERSION_PROTOCOL_NATIVE_CONNECTION_EVENTS,
|
||||
.destroy = on_server_connection_destroy,
|
||||
.start = on_start,
|
||||
};
|
||||
|
||||
|
|
@ -772,6 +781,12 @@ error:
|
|||
goto done;
|
||||
}
|
||||
|
||||
static void on_client_connection_destroy(void *data)
|
||||
{
|
||||
struct client *impl = data;
|
||||
spa_hook_remove(&impl->conn_listener);
|
||||
}
|
||||
|
||||
static void on_need_flush(void *data)
|
||||
{
|
||||
struct client *impl = data;
|
||||
|
|
@ -787,6 +802,7 @@ static void on_need_flush(void *data)
|
|||
|
||||
static const struct pw_protocol_native_connection_events client_conn_events = {
|
||||
PW_VERSION_PROTOCOL_NATIVE_CONNECTION_EVENTS,
|
||||
.destroy = on_client_connection_destroy,
|
||||
.need_flush = on_need_flush,
|
||||
};
|
||||
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue