[network-manager-netbook] Fix a crash on device added-removed-re-added



commit 695d784a11bf965137b0acf35fd8b1cd3584e338
Author: Tambet Ingo <tambet gmail com>
Date:   Thu Dec 10 11:31:26 2009 +0200

    Fix a crash on device added-removed-re-added
    
    Disconnect signal handlers, otherwise once a device is re-added, it'll trigger
    the signal handler for disposed object as well.

 libnm-gtk/nm-item-provider.c |    9 ++++++++-
 1 files changed, 8 insertions(+), 1 deletions(-)
---
diff --git a/libnm-gtk/nm-item-provider.c b/libnm-gtk/nm-item-provider.c
index 21e7bb9..5c460e0 100644
--- a/libnm-gtk/nm-item-provider.c
+++ b/libnm-gtk/nm-item-provider.c
@@ -236,9 +236,16 @@ dispose (GObject *object)
     NMItemProviderPrivate *priv = GET_PRIVATE (object);
 
     if (!priv->disposed) {
+        GSList *iter;
+
         nm_item_provider_clear (NM_ITEM_PROVIDER (object));
 
-        g_slist_foreach (priv->settings, (GFunc) g_object_unref, NULL);
+        for (iter = priv->settings; iter; iter = iter->next) {
+            GObject *settings = iter->data;
+
+            g_signal_handlers_disconnect_by_func (settings, connection_added, object);
+            g_object_unref (settings);
+        }
         g_slist_free (priv->settings);
 
         if (priv->client)



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