Fix Foreground Manager 42/231042/1
authorHwankyu Jhun <h.jhun@samsung.com>
Fri, 17 Apr 2020 03:07:33 +0000 (12:07 +0900)
committerHwankyu Jhun <h.jhun@samsung.com>
Fri, 17 Apr 2020 03:08:26 +0000 (12:08 +0900)
- Fixes memory leak
- Add logs for debugging

Change-Id: Ifdcb57045f1c166a6001db8f5cd12d4aaaa450da
Signed-off-by: Hwankyu Jhun <h.jhun@samsung.com>
src/core/amd_launch.c

index f6b684d1c6dd2950df50f807420273eda34a531c..9c5175c518bd15f60ffd8bb3427eea7f7a6e8d2d 100644 (file)
@@ -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);