From 8705af792b0c95ec94822b1727addb54389db674 Mon Sep 17 00:00:00 2001 From: Lennart Poettering Date: Mon, 2 Aug 2004 16:24:14 +0000 Subject: add new module "module-x11-bell" fix scache memory leak git-svn-id: file:///home/lennart/svn/public/pulseaudio/trunk@100 fefdeb5f-60dc-0310-8127-8f9354f1896f --- polyp/scache.c | 13 ++++++++++--- 1 file changed, 10 insertions(+), 3 deletions(-) (limited to 'polyp/scache.c') diff --git a/polyp/scache.c b/polyp/scache.c index d2a84827..c1505046 100644 --- a/polyp/scache.c +++ b/polyp/scache.c @@ -1,9 +1,11 @@ #include #include #include +#include #include "scache.h" #include "sink-input.h" +#include "mainloop.h" static void free_entry(struct pa_scache_entry *e) { assert(e); @@ -70,7 +72,8 @@ int pa_scache_remove_item(struct pa_core *c, const char *name) { return -1; pa_hashmap_remove(c->scache_hashmap, name); - pa_idxset_remove_by_index(c->scache_idxset, e->index); + if (pa_idxset_remove_by_data(c->scache_idxset, e, NULL) != e) + assert(0); free_entry(e); return 0; } @@ -113,10 +116,14 @@ static int sink_input_peek(struct pa_sink_input *i, struct pa_memchunk *chunk) { assert(c->length && c->memblock && c->memblock->length); *chunk = *c; pa_memblock_ref(c->memblock); - + return 0; } +static void si_kill(void *i) { + sink_input_kill(i); +} + static void sink_input_drop(struct pa_sink_input *i, size_t length) { struct pa_memchunk *c; assert(i && length && i->userdata); @@ -128,7 +135,7 @@ static void sink_input_drop(struct pa_sink_input *i, size_t length) { c->index += length; if (c->length <= 0) - sink_input_kill(i); + pa_mainloop_api_once(i->sink->core->mainloop, si_kill, i); } int pa_scache_play_item(struct pa_core *c, const char *name, struct pa_sink *sink, uint32_t volume) { -- cgit