mirror of
https://gitlab.freedesktop.org/pipewire/pipewire.git
synced 2025-11-02 09:01:50 -05:00
pulse-server: clear hook list when module is freed
Moreover, rename the hook list to "listener_list".
This commit is contained in:
parent
d9befc0792
commit
6f5b089767
2 changed files with 9 additions and 5 deletions
|
|
@ -51,7 +51,7 @@ struct module *module_new(struct impl *impl, const struct module_methods *method
|
||||||
|
|
||||||
module->impl = impl;
|
module->impl = impl;
|
||||||
module->methods = methods;
|
module->methods = methods;
|
||||||
spa_hook_list_init(&module->hooks);
|
spa_hook_list_init(&module->listener_list);
|
||||||
module->user_data = SPA_PTROFF(module, sizeof(struct module), void);
|
module->user_data = SPA_PTROFF(module, sizeof(struct module), void);
|
||||||
|
|
||||||
return module;
|
return module;
|
||||||
|
|
@ -61,7 +61,7 @@ static void module_add_listener(struct module *module,
|
||||||
struct spa_hook *listener,
|
struct spa_hook *listener,
|
||||||
const struct module_events *events, void *data)
|
const struct module_events *events, void *data)
|
||||||
{
|
{
|
||||||
spa_hook_list_append(&module->hooks, listener, events, data);
|
spa_hook_list_append(&module->listener_list, listener, events, data);
|
||||||
}
|
}
|
||||||
|
|
||||||
static int module_load(struct client *client, struct module *module)
|
static int module_load(struct client *client, struct module *module)
|
||||||
|
|
@ -77,13 +77,17 @@ static int module_load(struct client *client, struct module *module)
|
||||||
static void module_free(struct module *module)
|
static void module_free(struct module *module)
|
||||||
{
|
{
|
||||||
struct impl *impl = module->impl;
|
struct impl *impl = module->impl;
|
||||||
|
|
||||||
if (module->idx != SPA_ID_INVALID)
|
if (module->idx != SPA_ID_INVALID)
|
||||||
pw_map_remove(&impl->modules, module->idx & INDEX_MASK);
|
pw_map_remove(&impl->modules, module->idx & INDEX_MASK);
|
||||||
|
|
||||||
|
spa_hook_list_clean(&module->listener_list);
|
||||||
pw_work_queue_cancel(impl->work_queue, module, SPA_ID_INVALID);
|
pw_work_queue_cancel(impl->work_queue, module, SPA_ID_INVALID);
|
||||||
|
pw_properties_free(module->props);
|
||||||
|
|
||||||
free((char*)module->name);
|
free((char*)module->name);
|
||||||
free((char*)module->args);
|
free((char*)module->args);
|
||||||
pw_properties_free(module->props);
|
|
||||||
free(module);
|
free(module);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
||||||
|
|
@ -44,7 +44,7 @@ struct module_events {
|
||||||
void (*loaded) (void *data, int res);
|
void (*loaded) (void *data, int res);
|
||||||
};
|
};
|
||||||
|
|
||||||
#define module_emit_loaded(m,r) spa_hook_list_call(&m->hooks, struct module_events, loaded, 0, r)
|
#define module_emit_loaded(m,r) spa_hook_list_call(&m->listener_list, struct module_events, loaded, 0, r)
|
||||||
|
|
||||||
struct module_methods {
|
struct module_methods {
|
||||||
#define VERSION_MODULE_METHODS 0
|
#define VERSION_MODULE_METHODS 0
|
||||||
|
|
@ -61,7 +61,7 @@ struct module {
|
||||||
struct pw_properties *props;
|
struct pw_properties *props;
|
||||||
struct impl *impl;
|
struct impl *impl;
|
||||||
const struct module_methods *methods;
|
const struct module_methods *methods;
|
||||||
struct spa_hook_list hooks;
|
struct spa_hook_list listener_list;
|
||||||
void *user_data;
|
void *user_data;
|
||||||
};
|
};
|
||||||
|
|
||||||
|
|
|
||||||
Loading…
Add table
Add a link
Reference in a new issue