mirror of
https://gitlab.freedesktop.org/pipewire/pipewire.git
synced 2025-11-02 09:01:50 -05:00
pulse-server: module: do not schedule unloading multiple times
While it is not a problem since `module_free()` calls `pw_work_queue_cancel()`, it is completely unnecessary to do it more than once. Introduce a new flag on the module which stores whether or not an unloading has been scheduled.
This commit is contained in:
parent
4fbe3cbfc6
commit
b08da23715
2 changed files with 6 additions and 2 deletions
|
|
@ -50,8 +50,11 @@ static void on_module_unload(void *obj, void *data, int res, uint32_t id)
|
|||
|
||||
void module_schedule_unload(struct module *module)
|
||||
{
|
||||
struct impl *impl = module->impl;
|
||||
pw_work_queue_add(impl->work_queue, module, 0, on_module_unload, impl);
|
||||
if (module->unloading)
|
||||
return;
|
||||
|
||||
pw_work_queue_add(module->impl->work_queue, module, 0, on_module_unload, NULL);
|
||||
module->unloading = true;
|
||||
}
|
||||
|
||||
struct module *module_new(struct impl *impl, const struct module_methods *methods, size_t user_data)
|
||||
|
|
|
|||
|
|
@ -66,6 +66,7 @@ struct module {
|
|||
struct spa_hook_list listener_list;
|
||||
void *user_data;
|
||||
unsigned int loaded:1;
|
||||
unsigned int unloading:1;
|
||||
};
|
||||
|
||||
#define module_emit_loaded(m,r) spa_hook_list_call(&m->listener_list, struct module_events, loaded, 0, r)
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue