pulse-server: handle if the module is destroyed while loading

Create a new event for modules ('destroy') which is emitted from
`module_free()`. It is used by the module loading logic, to handle
when a module is destroyed without properly loading first.
This commit is contained in:
Barnabás Pőcze 2021-11-12 18:54:17 +01:00 committed by Wim Taymans
parent bd5a715200
commit 0e75b3fa0f
3 changed files with 10 additions and 0 deletions

View file

@ -45,6 +45,7 @@ struct module_events {
uint32_t version;
void (*loaded) (void *data, int result);
void (*destroy) (void *data);
};
struct module_methods {
@ -68,6 +69,7 @@ struct module {
};
#define module_emit_loaded(m,r) spa_hook_list_call(&m->listener_list, struct module_events, loaded, 0, r)
#define module_emit_destroy(m) spa_hook_list_call(&(m)->listener_list, struct module_events, destroy, 0)
struct module *module_create(struct client *client, const char *name, const char *args);
void module_free(struct module *module);