From bfe584cfafd9b71222789a03cfebce80ef09d4f9 Mon Sep 17 00:00:00 2001 From: Hyotaek Shim Date: Tue, 6 Aug 2019 11:20:13 +0900 Subject: [PATCH] Fix exit sequence root@localhost:~# systemctl stop feedbackd.service root@localhost:~# systemctl status feedbackd * feedbackd.service - System Vibrator Daemon Loaded: loaded (/usr/lib/systemd/system/feedbackd.service; disabled; vendor preset: enabled) Active: inactive (dead) since Mon 2018-08-13 08:11:48 KST; 4s ago Process: 804 ExecStart=/usr/bin/feedbackd (code=exited, status=0/SUCCESS) Main PID: 804 (code=exited, status=0/SUCCESS) Aug 13 08:11:47 localhost systemd[1]: Stopping System Vibrator Daemon... Aug 13 08:11:48 localhost feedbackd[804]: g_main_loop_unref: assertion 'loop != NULL' failed Aug 13 08:11:48 localhost systemd[1]: Stopped System Vibrator Daemon. Warning: Journal has been rotated since unit was started. Log output is incomplete or unavailable. Change-Id: I24178f135688a8cb5cec55c602baf79853ed37cb Signed-off-by: Hyotaek Shim --- src/core/main.c | 8 +++++--- 1 file changed, 5 insertions(+), 3 deletions(-) diff --git a/src/core/main.c b/src/core/main.c index 3134e63..03d1169 100644 --- a/src/core/main.c +++ b/src/core/main.c @@ -42,7 +42,6 @@ static void sig_usr1(int signo) if (mainloop) { if (g_main_loop_is_running(mainloop)) g_main_loop_quit(mainloop); - mainloop = NULL; } } @@ -84,8 +83,11 @@ int main(int argc, char **argv) _D("'Haptic' deinitialize."); haptic_exit(); - g_main_loop_unref(mainloop); - mainloop = NULL; + + if (mainloop) { + g_main_loop_unref(mainloop); + mainloop = NULL; + } return 0; } -- 2.7.4