From 1c6e5d4e818fd174ef16c97cbcc404ea9ee1aa6b Mon Sep 17 00:00:00 2001 From: Colin Guthrie Date: Wed, 8 Jun 2011 20:26:07 +0100 Subject: combine: Fix a crash on shutdown if the module is loaded outside of our control. By using module indexes rather than module pointers we avoid this posibility. --- src/modules/module-combine.c | 12 +++++++----- 1 file changed, 7 insertions(+), 5 deletions(-) (limited to 'src/modules') diff --git a/src/modules/module-combine.c b/src/modules/module-combine.c index bef2a987..58128849 100644 --- a/src/modules/module-combine.c +++ b/src/modules/module-combine.c @@ -39,20 +39,22 @@ PA_MODULE_LOAD_ONCE(FALSE); PA_MODULE_DEPRECATED("Please use module-combine-sink instead of module-combine!"); struct userdata { - pa_module *module; + uint32_t module_index; }; int pa__init(pa_module*m) { struct userdata *u; + pa_module *module; pa_assert(m); pa_assert_se(m->userdata = u = pa_xnew0(struct userdata, 1)); pa_log_warn("We will now load module-combine-sink. Please make sure to remove module-combine from your configuration."); - u->module = pa_module_load(m->core, "module-combine-sink", m->argument); + module = pa_module_load(m->core, "module-combine-sink", m->argument); + u->module_index = module ? module->index : PA_INVALID_INDEX; - return u->module ? 0 : -1; + return module ? 0 : -1; } @@ -64,8 +66,8 @@ void pa__done(pa_module*m) { u = m->userdata; - if (u) - pa_module_unload_request(u->module, TRUE); + if (u && PA_INVALID_INDEX != u->module_index) + pa_module_unload_by_index(m->core, u->module_index, TRUE); pa_xfree(u); } -- cgit