diff options
author | Aleksander Morgado <aleksander@lanedo.com> | 2012-10-09 16:30:09 +0200 |
---|---|---|
committer | Aleksander Morgado <aleksander@lanedo.com> | 2012-10-09 16:30:09 +0200 |
commit | 88d80935d6c5930fe0657da8383487a23c4705ab (patch) | |
tree | 180d5dde80916e1d535b708507a1d7a186951f64 /src/main.c | |
parent | caefbcfbd901d875f256adc61b12532f8f7777d3 (diff) |
core: second request to terminate does a hard exit()
Diffstat (limited to 'src/main.c')
-rw-r--r-- | src/main.c | 10 |
1 files changed, 9 insertions, 1 deletions
@@ -119,6 +119,7 @@ name_lost_cb (GDBusConnection *connection, int main (int argc, char *argv[]) { + GMainLoop *inner; GError *err = NULL; guint name_id; @@ -156,6 +157,11 @@ main (int argc, char *argv[]) loop = g_main_loop_new (NULL, FALSE); g_main_loop_run (loop); + /* Clear the global variable, so that subsequent requests to + * exit succeed. */ + inner = loop; + loop = NULL; + if (manager) { GTimer *timer; @@ -167,7 +173,7 @@ main (int argc, char *argv[]) timer = g_timer_new (); while (mm_manager_num_modems (manager) && g_timer_elapsed (timer, NULL) < (gdouble)MAX_SHUTDOWN_TIME_SECS) { - GMainContext *ctx = g_main_loop_get_context (loop); + GMainContext *ctx = g_main_loop_get_context (inner); g_main_context_iteration (ctx, FALSE); g_usleep (50); @@ -182,6 +188,8 @@ main (int argc, char *argv[]) g_timer_destroy (timer); } + g_main_loop_unref (inner); + g_bus_unown_name (name_id); mm_info ("ModemManager is shut down"); |