From: Hwankyu Jhun Date: Fri, 17 Apr 2020 03:07:33 +0000 (+0900) Subject: Fix Foreground Manager X-Git-Tag: submit/tizen/20200417.051505~1 X-Git-Url: http://review.tizen.org/git/?a=commitdiff_plain;h=1a24ba62b45f539901b89e8b2acd5a1a30650519;p=platform%2Fcore%2Fappfw%2Famd.git Fix Foreground Manager - Fixes memory leak - Add logs for debugging Change-Id: Ifdcb57045f1c166a6001db8f5cd12d4aaaa450da Signed-off-by: Hwankyu Jhun --- diff --git a/src/core/amd_launch.c b/src/core/amd_launch.c index f6b684d1..9c5175c5 100644 --- a/src/core/amd_launch.c +++ b/src/core/amd_launch.c @@ -1120,11 +1120,13 @@ static gboolean __fg_timeout_handler(gpointer data) return FALSE; app_status = _app_status_find(fg->pid); - if (app_status == NULL) - return FALSE; - - _W("%d is running in the background", fg->pid); - _app_status_update_status(app_status, STATUS_BG, true, true); + if (app_status) { + if (_app_status_get_status(app_status) != STATUS_VISIBLE) { + _W("%d is running in the background", fg->pid); + _app_status_update_status(app_status, STATUS_BG, + true, true); + } + } _fgmgr_list = g_list_remove(_fgmgr_list, fg); free(fg); @@ -1153,9 +1155,9 @@ static int __launch_add_fgmgr(int pid) { struct fgmgr *fg; + _W("Add timer. pid(%d)", pid); fg = __launch_find_fgmgr(pid); if (fg) { - _W("Reset timer. pid(%d)", pid); g_source_remove(fg->tid); } else { fg = calloc(1, sizeof(struct fgmgr)); @@ -1185,6 +1187,7 @@ static void __launch_remove_fgmgr(int pid) if (!fg) return; + _W("Remove timer. pid(%d)", pid); g_source_remove(fg->tid); _fgmgr_list = g_list_remove(_fgmgr_list, fg); free(fg);