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



commit 2caf2bbb0edfbf9c6209f0d844cabcdd2e641b3e
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 d092d6a..5ea2708 100644
--- a/src/miners/fs/tracker-main.c
+++ b/src/miners/fs/tracker-main.c
@@ -240,8 +240,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)) {
@@ -426,7 +429,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);
 		}
 
@@ -855,6 +858,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]