From f357b21c86fcc3b912f4226269a98fef764d18e8 Mon Sep 17 00:00:00 2001 From: Sangyoon Jang Date: Tue, 20 Jan 2015 10:38:22 +0900 Subject: [PATCH] Fix calling result callback when adding callback, it prepends the list but when finding callback, the first matching callback is called (LIFO) it should be FIFO Change-Id: Ied1d71b13be6e572c259eea08d29e59200ddf7bd Signed-off-by: Sangyoon Jang --- src/launch_with_result.c | 10 +++++----- 1 file changed, 5 insertions(+), 5 deletions(-) diff --git a/src/launch_with_result.c b/src/launch_with_result.c index b8ff4fd..00e3c7c 100644 --- a/src/launch_with_result.c +++ b/src/launch_with_result.c @@ -79,18 +79,18 @@ static void __add_resultcb(int pid, void (*cbfunc) (bundle *, int, void *), static app_resultcb_info_t *__find_resultcb(int pid) { app_resultcb_info_t *tmp; + app_resultcb_info_t *ret = NULL; pthread_mutex_lock(&result_lock); tmp = rescb_head; while (tmp) { - if (tmp->launched_pid == pid) { - pthread_mutex_unlock(&result_lock); - return tmp; - } + if (tmp->launched_pid == pid) + ret = tmp; tmp = tmp->next; } pthread_mutex_unlock(&result_lock); - return NULL; + + return ret; } static void __remove_resultcb(app_resultcb_info_t *info) -- 2.7.4