aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorLRN <lrn1986@gmail.com>2012-11-13 02:31:25 +0000
committerLRN <lrn1986@gmail.com>2012-11-13 02:31:25 +0000
commit61fb78563fe73d9c47ca15b6bdb5be7bfa60cbc0 (patch)
treef93a5771ac70829a46cecf6daff66ba3a4bd2352
parentf47d8ddb1757d063bc26ddf0650687f937e3fbcb (diff)
downloadgnunet-gtk-61fb78563fe73d9c47ca15b6bdb5be7bfa60cbc0.tar.gz
gnunet-gtk-61fb78563fe73d9c47ca15b6bdb5be7bfa60cbc0.zip
Make sure scheduler is shut down on exit
-rw-r--r--src/fs/gnunet-fs-gtk.c12
1 files changed, 11 insertions, 1 deletions
diff --git a/src/fs/gnunet-fs-gtk.c b/src/fs/gnunet-fs-gtk.c
index b88aba49..a71c4116 100644
--- a/src/fs/gnunet-fs-gtk.c
+++ b/src/fs/gnunet-fs-gtk.c
@@ -205,7 +205,8 @@ static void
205shutdown_task (void *cls, const struct GNUNET_SCHEDULER_TaskContext *tc) 205shutdown_task (void *cls, const struct GNUNET_SCHEDULER_TaskContext *tc)
206{ 206{
207 GNUNET_GTK_tray_icon_destroy (); 207 GNUNET_GTK_tray_icon_destroy ();
208 GNUNET_GTK_main_loop_quit (ml); 208 if (NULL != ml)
209 GNUNET_GTK_main_loop_quit (ml);
209 ml = NULL; 210 ml = NULL;
210 if (fs != NULL) 211 if (fs != NULL)
211 { 212 {
@@ -245,6 +246,15 @@ GNUNET_FS_GTK_delete_event_cb (GtkWidget *object,
245{ 246{
246 struct GNUNET_GTK_MainWindowContext *main_context = user_data; 247 struct GNUNET_GTK_MainWindowContext *main_context = user_data;
247 248
249 /* GNUNET_FS_GTK_delete_event_cb will eventually be called if we shut down
250 * the scheduler, because shutting it down will make GTK delete the main
251 * window. On the other hand, deleting the main window first (clicking on X
252 * button) will not trigger scheduler shutdown, unlike
253 * GNUNET_FS_GTK_menu_quit_activate_cb(). So we shut it down here again,
254 * just to be sure it is dead (if it isn't, application will hang up).
255 */
256 GNUNET_SCHEDULER_shutdown ();
257
248 GNUNET_GTK_tray_icon_destroy (); 258 GNUNET_GTK_tray_icon_destroy ();
249 GNUNET_SCHEDULER_add_with_priority (GNUNET_SCHEDULER_PRIORITY_IDLE, 259 GNUNET_SCHEDULER_add_with_priority (GNUNET_SCHEDULER_PRIORITY_IDLE,
250 &shutdown_task, NULL); 260 &shutdown_task, NULL);