From 575ba65714ab85d81b0e520f348d78c2ae80a6f9 Mon Sep 17 00:00:00 2001 From: Lennart Poettering Date: Thu, 21 Apr 2011 21:05:51 +0200 Subject: memblockq: decode unset chunks as NULL chunks again This fixes asserts beeing hit when see requests are posted via the native protocol. --- src/pulsecore/asyncmsgq.c | 2 +- src/pulsecore/memchunk.c | 9 +++++++++ src/pulsecore/memchunk.h | 3 +++ 3 files changed, 13 insertions(+), 1 deletion(-) (limited to 'src') diff --git a/src/pulsecore/asyncmsgq.c b/src/pulsecore/asyncmsgq.c index b0804f79..c211d9b0 100644 --- a/src/pulsecore/asyncmsgq.c +++ b/src/pulsecore/asyncmsgq.c @@ -321,7 +321,7 @@ void pa_asyncmsgq_write_after_poll(pa_asyncmsgq *a) { int pa_asyncmsgq_dispatch(pa_msgobject *object, int code, void *userdata, int64_t offset, pa_memchunk *memchunk) { if (object) - return object->process_msg(object, code, userdata, offset, memchunk); + return object->process_msg(object, code, userdata, offset, pa_memchunk_isset(memchunk) ? memchunk : NULL); return 0; } diff --git a/src/pulsecore/memchunk.c b/src/pulsecore/memchunk.c index 0bbf8590..34317fe5 100644 --- a/src/pulsecore/memchunk.c +++ b/src/pulsecore/memchunk.c @@ -110,3 +110,12 @@ pa_memchunk* pa_memchunk_memcpy(pa_memchunk *dst, pa_memchunk *src) { return dst; } + +pa_bool_t pa_memchunk_isset(pa_memchunk *chunk) { + assert(chunk); + + return + chunk->memblock || + chunk->index > 0 || + chunk->length > 0; +} diff --git a/src/pulsecore/memchunk.h b/src/pulsecore/memchunk.h index 9458f4ff..d7d82400 100644 --- a/src/pulsecore/memchunk.h +++ b/src/pulsecore/memchunk.h @@ -50,4 +50,7 @@ pa_memchunk *pa_memchunk_will_need(const pa_memchunk *c); /* Copy the data in the src memchunk to the dst memchunk */ pa_memchunk* pa_memchunk_memcpy(pa_memchunk *dst, pa_memchunk *src); +/* Return TRUE if any field is set != 0 */ +pa_bool_t pa_memchunk_isset(pa_memchunk *c); + #endif -- cgit