Code break requested for gnome-control-center : network



Simple fix to disconnect the idle sources, which fixes a crash if you
can move the mouse quick enough.

Patch attached.

Thanks,

Richard.
From f9c17ff1dd428ba901dbaae8cfc60972819c262b Mon Sep 17 00:00:00 2001
From: Richard Hughes <richard hughsie com>
Date: Mon, 26 Mar 2012 11:16:01 +0100
Subject: [PATCH] Fix a crash in the network panel by disconnecting idle
 sources

If you open and close the network panel again and again at speed, you can trigger a crash.
---
 panels/network/cc-network-panel.c |   18 ++++++++++++++++--
 1 file changed, 16 insertions(+), 2 deletions(-)

diff --git a/panels/network/cc-network-panel.c b/panels/network/cc-network-panel.c
index 7b8b5e5..7018a28 100644
--- a/panels/network/cc-network-panel.c
+++ b/panels/network/cc-network-panel.c
@@ -75,6 +75,8 @@ struct _CcNetworkPanelPrivate
         NMClient         *client;
         NMRemoteSettings *remote_settings;
         gboolean          updating_device;
+        guint             add_header_widgets_idle;
+        guint             nm_warning_idle;
         guint             refresh_idle;
         GtkWidget        *kill_switch_header;
 
@@ -209,6 +211,18 @@ cc_network_panel_dispose (GObject *object)
         if (priv->kill_switch_header != NULL) {
                 g_clear_object (&priv->kill_switch_header);
         }
+        if (priv->refresh_idle != 0) {
+                g_source_remove (priv->refresh_idle);
+                priv->refresh_idle = 0;
+        }
+        if (priv->nm_warning_idle != 0) {
+                g_source_remove (priv->nm_warning_idle);
+                priv->nm_warning_idle = 0;
+        }
+        if (priv->add_header_widgets_idle != 0) {
+                g_source_remove (priv->add_header_widgets_idle);
+                priv->add_header_widgets_idle = 0;
+        }
 
         G_OBJECT_CLASS (cc_network_panel_parent_class)->dispose (object);
 }
@@ -2554,7 +2568,7 @@ panel_check_network_manager_version (CcNetworkPanel *panel)
                 ret = FALSE;
 
                 /* do modal dialog in idle so we don't block startup */
-                g_idle_add ((GSourceFunc)display_version_warning_idle, panel);
+                panel->priv->nm_warning_idle = g_idle_add ((GSourceFunc)display_version_warning_idle, panel);
         }
 
         g_strfreev (split);
@@ -3651,7 +3665,7 @@ cc_network_panel_init (CcNetworkPanel *panel)
         gtk_widget_reparent (widget, (GtkWidget *) panel);
 
         /* add kill switch widgets when dialog activated */
-        g_idle_add (network_add_shell_header_widgets_cb, panel);
+        panel->priv->add_header_widgets_idle = g_idle_add (network_add_shell_header_widgets_cb, panel);
 }
 
 void
-- 
1.7.9.3



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