[gnome-initial-setup] network: Be more careful with timeouts



commit 7dca547c49df0e96c495416c0a98de9793e19c62
Author: Matthias Clasen <mclasen redhat com>
Date:   Tue Feb 24 09:14:30 2015 -0500

    network: Be more careful with timeouts
    
    We need to ensure we clear all outstanding timeouts when
    the page is disposed, or bad things will happen.
    
    https://bugzilla.redhat.com/show_bug.cgi?id=1174289

 .../pages/network/gis-network-page.c               |   14 +++++++++++++-
 1 files changed, 13 insertions(+), 1 deletions(-)
---
diff --git a/gnome-initial-setup/pages/network/gis-network-page.c 
b/gnome-initial-setup/pages/network/gis-network-page.c
index a454184..ddd1c87 100644
--- a/gnome-initial-setup/pages/network/gis-network-page.c
+++ b/gnome-initial-setup/pages/network/gis-network-page.c
@@ -59,6 +59,8 @@ struct _GisNetworkPagePrivate {
   NMDevice *nm_device;
   gboolean refreshing;
   GtkSizeGroup *icons;
+
+  guint refresh_timeout_id;
 };
 typedef struct _GisNetworkPagePrivate GisNetworkPagePrivate;
 
@@ -320,6 +322,10 @@ static gboolean
 refresh_again (gpointer user_data)
 {
   GisNetworkPage *page = GIS_NETWORK_PAGE (user_data);
+  GisNetworkPagePrivate *priv = gis_network_page_get_instance_private (page);
+
+  priv->refresh_timeout_id = 0;
+
   refresh_wireless_list (page);
   return FALSE;
 }
@@ -353,7 +359,7 @@ refresh_wireless_list (GisNetworkPage *page)
     gtk_widget_show (priv->no_network_spinner);
     gtk_widget_show (priv->no_network_label);
     gtk_widget_hide (priv->scrolled_window);
-    g_timeout_add_seconds (1, refresh_again, page);
+    priv->refresh_timeout_id = g_timeout_add_seconds (1, refresh_again, page);
 
     goto out;
   } else {
@@ -593,6 +599,12 @@ gis_network_page_dispose (GObject *object)
   g_clear_object (&priv->nm_device);
   g_clear_object (&priv->icons);
 
+  if (priv->refresh_timeout_id != 0)
+    {
+      g_source_remove (priv->refresh_timeout_id);
+      priv->refresh_timeout_id = 0;
+    }
+
   G_OBJECT_CLASS (gis_network_page_parent_class)->dispose (object);
 }
 


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