Fix exit sequence 91/211491/2
authorHyotaek Shim <hyotaek.shim@samsung.com>
Tue, 6 Aug 2019 02:20:13 +0000 (11:20 +0900)
committerHyotaek Shim <hyotaek.shim@samsung.com>
Tue, 6 Aug 2019 02:33:07 +0000 (11:33 +0900)
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 <hyotaek.shim@samsung.com>
src/core/main.c

index 3134e63..03d1169 100644 (file)
@@ -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;
 }