mirror of
https://gitlab.freedesktop.org/pulseaudio/pulseaudio.git
synced 2025-11-11 13:30:02 -05:00
Make sure the returned pa_msgobject object has a valid refcnt before returning it
git-svn-id: file:///home/lennart/svn/public/pulseaudio/branches/lennart@1495 fefdeb5f-60dc-0310-8127-8f9354f1896f
This commit is contained in:
parent
099f3f22d1
commit
77ebe70443
1 changed files with 10 additions and 4 deletions
|
|
@ -153,18 +153,24 @@ int pa_asyncmsgq_get(pa_asyncmsgq *a, pa_msgobject **object, int *code, void **u
|
|||
pa_assert(code);
|
||||
pa_assert(!a->current);
|
||||
|
||||
if (!(a->current = pa_asyncq_pop(a->asyncq, wait)))
|
||||
if (!(a->current = pa_asyncq_pop(a->asyncq, wait))) {
|
||||
/* pa_log("failure"); */
|
||||
return -1;
|
||||
}
|
||||
|
||||
/* pa_log("success"); */
|
||||
|
||||
*code = a->current->code;
|
||||
if (userdata)
|
||||
*userdata = a->current->userdata;
|
||||
if (object)
|
||||
*object = a->current->object;
|
||||
if (object) {
|
||||
if ((*object = a->current->object))
|
||||
pa_msgobject_assert_ref(*object);
|
||||
}
|
||||
if (chunk)
|
||||
*chunk = a->current->memchunk;
|
||||
|
||||
pa_log_debug("q=%p object=%p (%s) code=%i data=%p chunk.length=%u", (void*) a, (void*) a->current->object, a->current->object ? a->current->object->parent.type_name : NULL, a->current->code, (void*) a->current->userdata, a->current->memchunk.length);
|
||||
pa_log_debug("Get q=%p object=%p (%s) code=%i data=%p chunk.length=%u", (void*) a, (void*) a->current->object, a->current->object ? a->current->object->parent.type_name : NULL, a->current->code, (void*) a->current->userdata, a->current->memchunk.length);
|
||||
|
||||
return 0;
|
||||
}
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue