cli-command: unload modules synchronously

Users may want to change the parameters of some load-once modules in
~/.config/pulse/default.pa. That should be possible by including
/etc/pulse/default.pa from the per-user configuration file, and then
unloading a module and reloading it with different parameters. However,
that doesn't work, because the unload-module command will not unload the
module immediately, so the subsequent load-module command will fail when
the module can be loaded only once.

This patch makes the module unloading synchronous. "pacmd unload-module
module-cli-protocol-unix" is something that might not like this change,
since the command will unload the code that is processing the command,
but I tested it and it works fine. When pa_module_unload() is called,
that won't yet remove the module code from memory, the lt_dlclose() call
is postponed until it's safe to remove the code from memory.

BugLink: https://bugs.freedesktop.org/show_bug.cgi?id=102205
This commit is contained in:
Tanu Kaskinen 2017-08-18 10:07:27 +03:00
parent 5f27c2ec2f
commit 95404ce3f3

View file

@ -462,13 +462,13 @@ static int pa_cli_command_unload(pa_core *c, pa_tokenizer *t, pa_strbuf *buf, bo
return -1;
}
pa_module_unload_request(m, false);
pa_module_unload(m, false);
} else {
PA_IDXSET_FOREACH(m, c->modules, idx)
if (pa_streq(i, m->name)) {
unloaded = true;
pa_module_unload_request(m, false);
pa_module_unload(m, false);
}
if (unloaded == false) {