From 93deacd27394bf5b6e08c72f80f293bf9a5fc697 Mon Sep 17 00:00:00 2001 From: "aravind.gara" Date: Wed, 25 Oct 2017 15:07:23 +0900 Subject: [PATCH] Fix to prevent seg fault Add extra condition to avoid double free [Version] 0.0.10 [Issue Type] Bug fix Change-Id: Iac27cecbb30071433f7e5e169cf1e472900b1b2a Signed-off-by: aravind.gara --- packaging/capi-media-sound-pool.spec | 2 +- src/source.c | 10 +++++++--- 2 files changed, 8 insertions(+), 4 deletions(-) diff --git a/packaging/capi-media-sound-pool.spec b/packaging/capi-media-sound-pool.spec index f382a41..a6bfafd 100644 --- a/packaging/capi-media-sound-pool.spec +++ b/packaging/capi-media-sound-pool.spec @@ -1,5 +1,5 @@ Name: capi-media-sound-pool -Version: 0.0.9 +Version: 0.0.10 Summary: Tizen Sound Pool module Release: 0 Group: Multimedia/Framework diff --git a/src/source.c b/src/source.c index b5c74d9..c35d8af 100644 --- a/src/source.c +++ b/src/source.c @@ -22,7 +22,6 @@ #include "internal/source.h" #include "internal/stream.h" - #include #ifdef ENABLE_ALURE #include @@ -78,8 +77,13 @@ static sound_pool_error_e __sound_pool_remove_source(sound_pool_t *pool, sound_s while (g_hash_table_iter_next(&iter, &key, &value)) { guint size_before = g_hash_table_size(pool->streams); sound_stream_t *stream = (sound_stream_t*)value; - if (src == stream->parent_source) - _sound_stream_destroy((sound_stream_t*)value); + if (src == stream->parent_source) { + if (stream->state == SOUND_POOL_STREAM_STATE_STOPPED || stream->state == SOUND_POOL_STREAM_STATE_FINISHED) { + SP_DEBUG("Callback isolator thread destroying the stream"); + } else { + _sound_stream_destroy((sound_stream_t*)value); + } + } guint size_after = g_hash_table_size(pool->streams); if (size_before != size_after) g_hash_table_iter_init(&iter, pool->streams); -- 2.7.4