[network-manager-netbook] Fix a segfault



commit f5879e96f0e7f032a2f4b96d6eb078759d994b3c
Author: Tambet Ingo <tambet gmail com>
Date:   Thu Jan 21 10:21:44 2010 -0400

    Fix a segfault
    
    Apparently it crashes in Gtk when you call gtk_tree_model_get() from the
    signal handler of child tree's row-deleted signal. So delay the update of
    the active item. Fixes bnc #572162.

 libnm-gtk/nm-status-model.c |   18 ++++++++++++++++--
 1 files changed, 16 insertions(+), 2 deletions(-)
---
diff --git a/libnm-gtk/nm-status-model.c b/libnm-gtk/nm-status-model.c
index a0f482f..fbb9b49 100644
--- a/libnm-gtk/nm-status-model.c
+++ b/libnm-gtk/nm-status-model.c
@@ -53,14 +53,28 @@ nm_status_model_get_active_item (NMStatusModel *self)
     return item;
 }
 
-static void
-model_changed (NMStatusModel *self)
+static gboolean
+model_changed_cb (gpointer data)
 {
+    NMStatusModel *self = NM_STATUS_MODEL (data);
     NMListItem *item;
 
     item = nm_status_model_get_active_item (self);
     g_signal_emit (self, signals[CHANGED], 0, item);
     g_object_unref (item);
+
+    return FALSE;
+}
+
+static void
+model_changed (NMStatusModel *self)
+{
+    GSource *source;
+
+    source = g_idle_source_new ();
+    g_source_set_closure (source, g_cclosure_new_object (G_CALLBACK (model_changed_cb), G_OBJECT (self)));
+    g_source_attach (source, NULL);
+    g_source_unref (source);
 }
 
 static gboolean



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