/* Called from main context */ void pa_source_output_unlink(pa_source_output*o) { pa_bool_t linked; pa_assert(o); pa_assert_ctl_context(); /* See pa_sink_unlink() for a couple of comments how this function * works */ pa_source_output_ref(o); linked = PA_SOURCE_OUTPUT_IS_LINKED(o->state); if (linked) pa_hook_fire(&o->core->hooks[PA_CORE_HOOK_SOURCE_OUTPUT_UNLINK], o); if (o->direct_on_input) pa_idxset_remove_by_data(o->direct_on_input->direct_outputs, o, NULL); pa_idxset_remove_by_data(o->core->source_outputs, o, NULL); if (o->source) if (pa_idxset_remove_by_data(o->source->outputs, o, NULL)) pa_source_output_unref(o); if (o->client) pa_idxset_remove_by_data(o->client->source_outputs, o, NULL); update_n_corked(o, PA_SOURCE_OUTPUT_UNLINKED); o->state = PA_SOURCE_OUTPUT_UNLINKED; if (linked && o->source) if (o->source->asyncmsgq) pa_assert_se(pa_asyncmsgq_send(o->source->asyncmsgq, PA_MSGOBJECT(o->source), PA_SOURCE_MESSAGE_REMOVE_OUTPUT, o, 0, NULL) == 0); reset_callbacks(o); if (linked) { pa_subscription_post(o->core, PA_SUBSCRIPTION_EVENT_SOURCE_OUTPUT|PA_SUBSCRIPTION_EVENT_REMOVE, o->index); pa_hook_fire(&o->core->hooks[PA_CORE_HOOK_SOURCE_OUTPUT_UNLINK_POST], o); } if (o->source) { pa_source_update_status(o->source); o->source = NULL; } pa_core_maybe_vacuum(o->core); pa_source_output_unref(o); }
void pa_client_free(pa_client *c) { pa_core *core; pa_assert(c); pa_assert(c->core); core = c->core; pa_hook_fire(&core->hooks[PA_CORE_HOOK_CLIENT_UNLINK], c); pa_idxset_remove_by_data(c->core->clients, c, NULL); pa_log_info("Freed %u \"%s\"", c->index, pa_strnull(pa_proplist_gets(c->proplist, PA_PROP_APPLICATION_NAME))); pa_subscription_post(c->core, PA_SUBSCRIPTION_EVENT_CLIENT|PA_SUBSCRIPTION_EVENT_REMOVE, c->index); pa_assert(pa_idxset_isempty(c->sink_inputs)); pa_idxset_free(c->sink_inputs, NULL); pa_assert(pa_idxset_isempty(c->source_outputs)); pa_idxset_free(c->source_outputs, NULL); pa_proplist_free(c->proplist); pa_xfree(c->driver); pa_xfree(c); pa_core_check_idle(core); }
/* Called from main context */ int pa_source_output_start_move(pa_source_output *o) { pa_source *origin; int r; pa_source_output_assert_ref(o); pa_assert_ctl_context(); pa_assert(PA_SOURCE_OUTPUT_IS_LINKED(o->state)); pa_assert(o->source); if (!pa_source_output_may_move(o)) return -PA_ERR_NOTSUPPORTED; if ((r = pa_hook_fire(&o->core->hooks[PA_CORE_HOOK_SOURCE_OUTPUT_MOVE_START], o)) < 0) return r; origin = o->source; pa_idxset_remove_by_data(o->source->outputs, o, NULL); if (pa_source_output_get_state(o) == PA_SOURCE_OUTPUT_CORKED) pa_assert_se(origin->n_corked-- >= 1); pa_assert_se(pa_asyncmsgq_send(o->source->asyncmsgq, PA_MSGOBJECT(o->source), PA_SOURCE_MESSAGE_REMOVE_OUTPUT, o, 0, NULL) == 0); pa_source_update_status(o->source); o->source = NULL; pa_source_output_unref(o); return 0; }
static void cli_unlink(pa_cli_protocol *p, pa_cli *c) { pa_assert(p); pa_assert(c); pa_idxset_remove_by_data(p->connections, c, NULL); pa_cli_free(c); }
static void entry_remove_and_free(pa_autoload_entry *e) { pa_assert(e); pa_assert(e->core); pa_idxset_remove_by_data(e->core->autoload_idxset, e, NULL); pa_hashmap_remove(e->core->autoload_hashmap, e->name); entry_free(e); }
void pa_module_unload(pa_core *c, pa_module *m, pa_bool_t force) { pa_assert(c); pa_assert(m); if (m->core->disallow_module_loading && !force) return; if (!(m = pa_idxset_remove_by_data(c->modules, m, NULL))) return; pa_module_free(m); }
int pa_scache_remove_item(pa_core *c, const char *name) { pa_scache_entry *e; pa_assert(c); pa_assert(name); if (!(e = pa_namereg_get(c, name, PA_NAMEREG_SAMPLE))) return -1; pa_assert_se(pa_idxset_remove_by_data(c->scache, e, NULL) == e); pa_log_debug("Removed sample \"%s\"", name); free_entry(e); return 0; }
static void connection_unlink(connection *c) { pa_assert(c); if (!c->protocol) return; if (c->options) { pa_simple_options_unref(c->options); c->options = NULL; } if (c->sink_input) { pa_sink_input_unlink(c->sink_input); pa_sink_input_unref(c->sink_input); c->sink_input = NULL; } if (c->source_output) { pa_source_output_unlink(c->source_output); pa_source_output_unref(c->source_output); c->source_output = NULL; } if (c->client) { pa_client_free(c->client); c->client = NULL; } if (c->io) { pa_iochannel_free(c->io); c->io = NULL; } pa_idxset_remove_by_data(c->protocol->connections, c, NULL); c->protocol = NULL; connection_unref(c); }
static void free_func(void *p, PA_GCC_UNUSED void *userdata) { pa_autoload_entry *e = p; pa_idxset_remove_by_data(e->core->autoload_idxset, e, NULL); entry_free(e); }