On Tue, 2013-09-24 at 19:45 -0300, jprvita at gmail.com wrote: > +void pa__done(pa_module* m) { > + struct userdata *u; > + > + pa_assert(m); > + > + if (!(u = m->userdata)) > + return; > + > + if (u->bluez5_module) > + pa_module_unload(m->core, u->bluez5_module, true); > + > + if (u->bluez4_module) > + pa_module_unload(m->core, u->bluez4_module, true); This crashes when shutting down the daemon, because when the daemon unloads all modules, module-bluez*-discover gets unloaded before module-bluetooth-discover, so the y->bluez5_module and u->bluez4_module pointers become stale. I see two ways of fixing this: add a hook that is fired when modules are unloaded and use that hook in module-bluetooth-discover to drop the reference to the unloaded module, or unload module-bluetooth-discover immediately after loading module-bluez5-discover and module-bluez4-discover. The second solution is of course much simpler, but I proposed that already earlier, and you didn't like that. -- Tanu