[tracker/tracker-0.12] miners/fs: Fix crash when SIGTERM happens before mainloop is available



commit a7d802540c4af795eaa305116fa5a1687ddff59d
Author: Philip Van Hoof <philip codeminded be>
Date:   Tue Jan 24 11:15:39 2012 +0100

    miners/fs: Fix crash when SIGTERM happens before mainloop is available
    
    Fixes NB#296488.

 src/miners/fs/tracker-main.c |   10 +++++++---
 1 files changed, 7 insertions(+), 3 deletions(-)
---
diff --git a/src/miners/fs/tracker-main.c b/src/miners/fs/tracker-main.c
index 67c3870..d64ca70 100644
--- a/src/miners/fs/tracker-main.c
+++ b/src/miners/fs/tracker-main.c
@@ -140,8 +140,11 @@ signal_handler (int signo)
 	case SIGTERM:
 	case SIGINT:
 		in_loop = TRUE;
-		g_main_loop_quit (main_loop);
-
+		if (main_loop != NULL) {
+			g_main_loop_quit (main_loop);
+		} else {
+			exit (0);
+		}
 		/* Fall through */
 	default:
 		if (g_strsignal (signo)) {
@@ -270,7 +273,7 @@ miner_handle_next (void)
 		/* We're not sticking around for file updates, so stop
 		 * the mainloop and exit.
 		 */
-		if (no_daemon) {
+		if (no_daemon && main_loop) {
 			g_main_loop_quit (main_loop);
 		}
 
@@ -694,6 +697,7 @@ main (gint argc, gchar *argv[])
 	gboolean force_mtime_checking = FALSE;
 	gboolean store_available;
 
+	main_loop = NULL;
 	g_type_init ();
 
 	setlocale (LC_ALL, "");



[Date Prev][Date Next]   [Thread Prev][Thread Next]   [Thread Index] [Date Index] [Author Index]