summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
-rw-r--r--src/modules/bluetooth/module-bluetooth-device.c18
-rw-r--r--src/pulsecore/rtpoll.c2
2 files changed, 12 insertions, 8 deletions
diff --git a/src/modules/bluetooth/module-bluetooth-device.c b/src/modules/bluetooth/module-bluetooth-device.c
index 3498088d..6daae83c 100644
--- a/src/modules/bluetooth/module-bluetooth-device.c
+++ b/src/modules/bluetooth/module-bluetooth-device.c
@@ -1522,6 +1522,13 @@ static void stop_thread(struct userdata *u) {
pa_source_unref(u->source);
u->source = NULL;
}
+
+ pa_thread_mq_done(&u->thread_mq);
+
+ if (u->rtpoll) {
+ pa_rtpoll_free(u->rtpoll);
+ u->rtpoll = NULL;
+ }
}
static int start_thread(struct userdata *u) {
@@ -1529,6 +1536,7 @@ static int start_thread(struct userdata *u) {
pa_assert(u);
pa_assert(!u->thread);
+ pa_assert(!u->rtpoll);
pa_assert(!u->rtpoll_item);
if (USE_SCO_OVER_PCM(u)) {
@@ -1537,6 +1545,9 @@ static int start_thread(struct userdata *u) {
return 0;
}
+ u->rtpoll = pa_rtpoll_new();
+ pa_thread_mq_init(&u->thread_mq, u->core->mainloop, u->rtpoll);
+
u->rtpoll_item = pa_rtpoll_item_new(u->rtpoll, PA_RTPOLL_NEVER, 1);
pollfd = pa_rtpoll_item_get_pollfd(u->rtpoll_item, NULL);
pollfd->fd = u->stream_fd;
@@ -1764,8 +1775,6 @@ int pa__init(pa_module* m) {
u->service_fd = -1;
u->stream_fd = -1;
u->read_smoother = pa_smoother_new(PA_USEC_PER_SEC, PA_USEC_PER_SEC*2, TRUE, 10);
- u->rtpoll = pa_rtpoll_new();
- pa_thread_mq_init(&u->thread_mq, u->core->mainloop, u->rtpoll);
u->sample_spec = m->core->default_sample_spec;
u->modargs = ma;
@@ -1921,11 +1930,6 @@ void pa__done(pa_module *m) {
if (u->card)
pa_card_free(u->card);
- pa_thread_mq_done(&u->thread_mq);
-
- if (u->rtpoll)
- pa_rtpoll_free(u->rtpoll);
-
if (u->read_smoother)
pa_smoother_free(u->read_smoother);
diff --git a/src/pulsecore/rtpoll.c b/src/pulsecore/rtpoll.c
index 543262bc..183d97c2 100644
--- a/src/pulsecore/rtpoll.c
+++ b/src/pulsecore/rtpoll.c
@@ -156,7 +156,7 @@ void pa_rtpoll_install(pa_rtpoll *p) {
pa_assert(p);
pa_assert(!p->installed);
- p->installed = 1;
+ p->installed = TRUE;
#ifdef HAVE_PPOLL
# ifdef __linux__