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