summaryrefslogtreecommitdiffstats
path: root/src/pulse/ext-stream-restore.c
diff options
context:
space:
mode:
Diffstat (limited to 'src/pulse/ext-stream-restore.c')
-rw-r--r--src/pulse/ext-stream-restore.c11
1 files changed, 10 insertions, 1 deletions
diff --git a/src/pulse/ext-stream-restore.c b/src/pulse/ext-stream-restore.c
index 469c822a..63c911f8 100644
--- a/src/pulse/ext-stream-restore.c
+++ b/src/pulse/ext-stream-restore.c
@@ -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
@@ -31,6 +31,7 @@
#include "internal.h"
#include "operation.h"
+#include "fork-detect.h"
#include "ext-stream-restore.h"
@@ -87,6 +88,7 @@ pa_operation *pa_ext_stream_restore_test(
pa_assert(c);
pa_assert(PA_REFCNT_VALUE(c) >= 1);
+ PA_CHECK_VALIDITY_RETURN_NULL(c, !pa_detect_fork(), PA_ERR_FORKED);
PA_CHECK_VALIDITY_RETURN_NULL(c, c->state == PA_CONTEXT_READY, PA_ERR_BADSTATE);
PA_CHECK_VALIDITY_RETURN_NULL(c, c->version >= 14, PA_ERR_NOTSUPPORTED);
@@ -167,6 +169,7 @@ pa_operation *pa_ext_stream_restore_read(
pa_assert(c);
pa_assert(PA_REFCNT_VALUE(c) >= 1);
+ PA_CHECK_VALIDITY_RETURN_NULL(c, !pa_detect_fork(), PA_ERR_FORKED);
PA_CHECK_VALIDITY_RETURN_NULL(c, c->state == PA_CONTEXT_READY, PA_ERR_BADSTATE);
PA_CHECK_VALIDITY_RETURN_NULL(c, c->version >= 14, PA_ERR_NOTSUPPORTED);
@@ -200,6 +203,7 @@ pa_operation *pa_ext_stream_restore_write(
pa_assert(mode == PA_UPDATE_MERGE || mode == PA_UPDATE_REPLACE || mode == PA_UPDATE_SET);
pa_assert(data);
+ PA_CHECK_VALIDITY_RETURN_NULL(c, !pa_detect_fork(), PA_ERR_FORKED);
PA_CHECK_VALIDITY_RETURN_NULL(c, c->state == PA_CONTEXT_READY, PA_ERR_BADSTATE);
PA_CHECK_VALIDITY_RETURN_NULL(c, c->version >= 14, PA_ERR_NOTSUPPORTED);
@@ -262,6 +266,7 @@ pa_operation *pa_ext_stream_restore_delete(
pa_assert(PA_REFCNT_VALUE(c) >= 1);
pa_assert(s);
+ PA_CHECK_VALIDITY_RETURN_NULL(c, !pa_detect_fork(), PA_ERR_FORKED);
PA_CHECK_VALIDITY_RETURN_NULL(c, c->state == PA_CONTEXT_READY, PA_ERR_BADSTATE);
PA_CHECK_VALIDITY_RETURN_NULL(c, c->version >= 14, PA_ERR_NOTSUPPORTED);
@@ -310,6 +315,7 @@ pa_operation *pa_ext_stream_restore_subscribe(
pa_assert(c);
pa_assert(PA_REFCNT_VALUE(c) >= 1);
+ PA_CHECK_VALIDITY_RETURN_NULL(c, !pa_detect_fork(), PA_ERR_FORKED);
PA_CHECK_VALIDITY_RETURN_NULL(c, c->state == PA_CONTEXT_READY, PA_ERR_BADSTATE);
PA_CHECK_VALIDITY_RETURN_NULL(c, c->version >= 14, PA_ERR_NOTSUPPORTED);
@@ -334,6 +340,9 @@ void pa_ext_stream_restore_set_subscribe_cb(
pa_assert(c);
pa_assert(PA_REFCNT_VALUE(c) >= 1);
+ if (pa_detect_fork())
+ return;
+
c->ext_stream_restore.callback = cb;
c->ext_stream_restore.userdata = userdata;
}