From 9820db2433a37aa1f22d962bb89876c66bcc1185 Mon Sep 17 00:00:00 2001
From: Wim Taymans <wtaymans@redhat.com>
Date: Mon, 30 Jan 2017 11:52:54 +0100
Subject: [PATCH 14/18] core: ensure maincontext for current client
Make sure we can only access the current client from the main context.
---
src/pulsecore/core.c | 6 +++++-
1 file changed, 5 insertions(+), 1 deletion(-)
diff --git a/src/pulsecore/core.c b/src/pulsecore/core.c
index 311d31f..f14139f 100644
--- a/src/pulsecore/core.c
+++ b/src/pulsecore/core.c
@@ -335,17 +335,20 @@ pa_mempool* pa_core_new_mempool(pa_core *c, pa_mem_type_t shm_type, bool per_cli
}
pa_client* pa_core_get_current_client(pa_core *c) {
+ pa_assert_ctl_context();
return c->current_client;
}
void pa_core_set_current_client(pa_core *c, pa_client *client) {
- c->current_client = client;
+ pa_assert_ctl_context();
+ c->current_client = client;
}
bool pa_core_check_access_sync(pa_core *c, pa_access_hook_t hook, uint32_t idx, pa_subscription_event_type_t event, const char *name) {
pa_access_data data;
pa_assert(c);
+ pa_assert_ctl_context();
if (c->current_client == NULL)
return true;
@@ -363,6 +366,7 @@ bool pa_core_check_access_sync(pa_core *c, pa_access_hook_t hook, uint32_t idx,
pa_hook_result_t pa_core_check_access(pa_core *c, pa_access_data *data) {
pa_assert(c);
pa_assert(data);
+ pa_assert_ctl_context();
if (c->current_client == NULL)
return PA_HOOK_OK;
--
2.9.3