All pastes #1699405 Raw Edit

Mine

public text v1 · immutable
#1699405 ·published 2009-12-03 01:25 UTC
rendered paste body
diff --git a/src/main.c b/src/main.c
index 3b95e15..da42026 100644
--- a/src/main.c
+++ b/src/main.c
@@ -36,7 +36,7 @@
 #define SHUTDOWN_GRACE_SECONDS 10
 
 static GMainLoop *event_loop;
-static guint quit_eventloop_source = 0;
+static guint quit_source = 0;
 
 void __ofono_exit()
 {
@@ -49,6 +49,14 @@ static gboolean quit_eventloop(gpointer user_data)
 	return FALSE;
 }
 
+static gboolean quit_request(gpointer user_data)
+{
+	g_timeout_add_seconds(SHUTDOWN_GRACE_SECONDS, quit_eventloop, NULL);
+	__ofono_modem_shutdown();
+
+	return FALSE;
+}
+
 static void sig_debug(int sig)
 {
 	__ofono_toggle_debug();
@@ -56,12 +64,10 @@ static void sig_debug(int sig)
 
 static void sig_term(int sig)
 {
-	if (quit_eventloop_source != 0)
+	if (quit_source != 0)
 		return;
 
-	quit_eventloop_source = g_timeout_add_seconds(SHUTDOWN_GRACE_SECONDS,
-							quit_eventloop, NULL);
-	__ofono_modem_shutdown();
+	quit_source = g_idle_add(quit_request, NULL);
 }
 
 static void system_bus_disconnected(DBusConnection *conn, void *user_data)