Check if the main loop is stopped properly 57/215357/2
authorHwankyu Jhun <h.jhun@samsung.com>
Mon, 7 Oct 2019 09:18:21 +0000 (18:18 +0900)
committerHwanKyu Jhun <h.jhun@samsung.com>
Mon, 7 Oct 2019 23:27:10 +0000 (23:27 +0000)
If the main loop is stopped forcedly, the loader_terminate_cb callback
function must not be called.

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

index 5ce202ed53d88b5564d97f8e31540b592c4e85d2..c3f41d8b762365302a19bfad59b6075bd7929bc2 100644 (file)
@@ -54,6 +54,7 @@ static int __loader_type = LAUNCHPAD_TYPE_UNSUPPORTED;
 static int __loader_id;
 static pid_t __candidate_pid = -1;
 static struct sigaction __prev_sigchld;
+static bool __loop_quit;
 
 static void __at_exit_to_release_bundle(void)
 {
@@ -309,6 +310,7 @@ static void __receiver_cb(int fd)
        if (ret >= 0) {
                __loader_adapter->loop_quit(__loader_user_data);
                _D("[candidate] ecore main loop quit");
+               __loop_quit = true;
        }
 }
 
@@ -547,6 +549,11 @@ API int launchpad_loader_main(int argc, char **argv,
        _D("[candidate] ecore main loop begin");
        __loader_adapter->loop_begin(__loader_user_data);
 
+       if (!__loop_quit) {
+               _E("[candidate] loop was stopped forcedly");
+               return -1;
+       }
+
        return __after_loop();
 }
 
@@ -681,4 +688,4 @@ API int launchpad_hydra_main(int argc, char **argv,
        }
 
        return 0;
-}
\ No newline at end of file
+}