diff options
author | Lennart Poettering <lennart@poettering.net> | 2004-08-02 16:24:14 +0000 |
---|---|---|
committer | Lennart Poettering <lennart@poettering.net> | 2004-08-02 16:24:14 +0000 |
commit | 8705af792b0c95ec94822b1727addb54389db674 (patch) | |
tree | 96906ab98e1b5f1a2e4a909f0aa5fa659987c7b1 /polyp/scache.c | |
parent | 5a694fd508d3b5d9b2433f041aa24feb5a9ebc40 (diff) |
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
Diffstat (limited to 'polyp/scache.c')
-rw-r--r-- | polyp/scache.c | 13 |
1 files changed, 10 insertions, 3 deletions
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 <assert.h> #include <stdlib.h> #include <string.h> +#include <stdio.h> #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) { |