struct loopback_msg {
pa_msgobject parent;
struct userdata *userdata;
+ bool dead;
};
PA_DEFINE_PRIVATE_CLASS(loopback_msg, pa_msgobject);
u->adjust_time = 0;
enable_adjust_timer(u, false);
+ if (u->msg)
+ u->msg->dead = true;
+
/* Handling the asyncmsgq between the source output and the sink input
* requires some care. When the source output is unlinked, nothing needs
* to be done for the asyncmsgq, because the source output is the sending
pa_assert_ctl_context();
msg = LOOPBACK_MSG(o);
+
+ /* If messages are processed after a module unload request, they
+ * must be ignored. */
+ if (msg->dead)
+ return 0;
+
pa_assert_se(u = msg->userdata);
switch (code) {
u->msg = pa_msgobject_new(loopback_msg);
u->msg->parent.process_msg = loopback_process_msg_cb;
u->msg->userdata = u;
+ u->msg->dead = false;
/* The output thread is not yet running, set effective_source_latency directly */
update_effective_source_latency(u, u->source_output->source, NULL);
if (u->asyncmsgq)
pa_asyncmsgq_unref(u->asyncmsgq);
+ if (u->msg)
+ loopback_msg_unref(u->msg);
+
pa_xfree(u);
}