]> code.delx.au - pulseaudio/blobdiff - src/modules/module-always-sink.c
dbusiface-core: Make the interface string a public constant.
[pulseaudio] / src / modules / module-always-sink.c
index cd3f31122daa440269442b80bf9e942f25c8f9ec..aee1c650f69bb56ce553a385eb8f77196a7dab71 100644 (file)
@@ -5,7 +5,7 @@
 
     PulseAudio is free software; you can redistribute it and/or modify
     it under the terms of the GNU Lesser General Public License as published
-    by the Free Software Foundation; either version 2 of the License,
+    by the Free Software Foundation; either version 2.1 of the License,
     or (at your option) any later version.
 
     PulseAudio is distributed in the hope that it will be useful, but
@@ -100,6 +100,10 @@ static pa_hook_result_t put_hook_callback(pa_core *c, pa_sink *sink, void* userd
     if (u->ignore)
         return PA_HOOK_OK;
 
+    /* There's no point in doing anything if the core is shut down anyway */
+    if (c->state == PA_CORE_SHUTDOWN)
+        return PA_HOOK_OK;
+
     /* Auto-loaded null-sink not active, so ignoring newly detected sink. */
     if (u->null_module == PA_INVALID_INDEX)
         return PA_HOOK_OK;
@@ -130,6 +134,10 @@ static pa_hook_result_t unlink_hook_callback(pa_core *c, pa_sink *sink, void* us
         return PA_HOOK_OK;
     }
 
+    /* There's no point in doing anything if the core is shut down anyway */
+    if (c->state == PA_CORE_SHUTDOWN)
+        return PA_HOOK_OK;
+
     load_null_sink_if_needed(c, sink, u);
 
     return PA_HOOK_OK;
@@ -172,7 +180,7 @@ void pa__done(pa_module*m) {
         pa_hook_slot_free(u->put_slot);
     if (u->unlink_slot)
         pa_hook_slot_free(u->unlink_slot);
-    if (u->null_module != PA_INVALID_INDEX)
+    if (u->null_module != PA_INVALID_INDEX && m->core->state != PA_CORE_SHUTDOWN)
         pa_module_unload_request_by_index(m->core, u->null_module, TRUE);
 
     pa_xfree(u->sink_name);