mirror of
https://gitlab.freedesktop.org/pipewire/pipewire.git
synced 2025-11-02 09:01:50 -05:00
pulse-server: don't broadcast remove event when a module wasn't loaded
This commit is contained in:
parent
f26358e958
commit
4d02233ff3
3 changed files with 9 additions and 5 deletions
|
|
@ -53,6 +53,7 @@ struct module *module_new(struct impl *impl, const struct module_methods *method
|
||||||
module->methods = methods;
|
module->methods = methods;
|
||||||
spa_hook_list_init(&module->listener_list);
|
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);
|
||||||
|
module->loaded = false;
|
||||||
|
|
||||||
return module;
|
return module;
|
||||||
}
|
}
|
||||||
|
|
@ -94,7 +95,6 @@ static void module_free(struct module *module)
|
||||||
static int module_unload(struct client *client, struct module *module)
|
static int module_unload(struct client *client, struct module *module)
|
||||||
{
|
{
|
||||||
struct impl *impl = module->impl;
|
struct impl *impl = module->impl;
|
||||||
uint32_t module_idx = module->idx;
|
|
||||||
int res = 0;
|
int res = 0;
|
||||||
|
|
||||||
/* Note that client can be NULL (when the module is being unloaded
|
/* Note that client can be NULL (when the module is being unloaded
|
||||||
|
|
@ -105,12 +105,13 @@ static int module_unload(struct client *client, struct module *module)
|
||||||
if (module->methods->unload)
|
if (module->methods->unload)
|
||||||
res = module->methods->unload(client, module);
|
res = module->methods->unload(client, module);
|
||||||
|
|
||||||
module_free(module);
|
if (module->loaded)
|
||||||
|
broadcast_subscribe_event(impl,
|
||||||
broadcast_subscribe_event(impl,
|
|
||||||
SUBSCRIPTION_MASK_MODULE,
|
SUBSCRIPTION_MASK_MODULE,
|
||||||
SUBSCRIPTION_EVENT_REMOVE | SUBSCRIPTION_EVENT_MODULE,
|
SUBSCRIPTION_EVENT_REMOVE | SUBSCRIPTION_EVENT_MODULE,
|
||||||
module_idx);
|
module->idx);
|
||||||
|
|
||||||
|
module_free(module);
|
||||||
|
|
||||||
return res;
|
return res;
|
||||||
}
|
}
|
||||||
|
|
|
||||||
|
|
@ -63,6 +63,7 @@ struct module {
|
||||||
const struct module_methods *methods;
|
const struct module_methods *methods;
|
||||||
struct spa_hook_list listener_list;
|
struct spa_hook_list listener_list;
|
||||||
void *user_data;
|
void *user_data;
|
||||||
|
unsigned int loaded:1;
|
||||||
};
|
};
|
||||||
|
|
||||||
struct module *module_new(struct impl *impl, const struct module_methods *methods, size_t user_data);
|
struct module *module_new(struct impl *impl, const struct module_methods *methods, size_t user_data);
|
||||||
|
|
|
||||||
|
|
@ -5017,6 +5017,8 @@ static void on_module_loaded(void *data, int error)
|
||||||
|
|
||||||
pw_log_info(NAME" %p: [%s] module %d loaded", client->impl, client->name, module->idx);
|
pw_log_info(NAME" %p: [%s] module %d loaded", client->impl, client->name, module->idx);
|
||||||
|
|
||||||
|
module->loaded = true;
|
||||||
|
|
||||||
broadcast_subscribe_event(impl,
|
broadcast_subscribe_event(impl,
|
||||||
SUBSCRIPTION_MASK_MODULE,
|
SUBSCRIPTION_MASK_MODULE,
|
||||||
SUBSCRIPTION_EVENT_NEW | SUBSCRIPTION_EVENT_MODULE,
|
SUBSCRIPTION_EVENT_NEW | SUBSCRIPTION_EVENT_MODULE,
|
||||||
|
|
|
||||||
Loading…
Add table
Add a link
Reference in a new issue