[glade/composite-templates-new: 2/5] GladeWindow: Avoid crash while closing multiple projects.



commit 772c0fd5bd7955e2fb784a7c641e57e1f4119862
Author: Tristan Van Berkom <tristan van berkom gmail com>
Date:   Sun Mar 31 20:45:18 2013 +0900

    GladeWindow: Avoid crash while closing multiple projects.
    
    Instead of iterating on the list returned by gtk_action_get_proxies(),
    iterate on a temporary copy of that list.

 src/glade-window.c |    8 ++++++--
 1 files changed, 6 insertions(+), 2 deletions(-)
---
diff --git a/src/glade-window.c b/src/glade-window.c
index 05a0e09..6fab4f3 100644
--- a/src/glade-window.c
+++ b/src/glade-window.c
@@ -939,10 +939,14 @@ refresh_projects_list_menu (GladeWindow *window)
     {
       GtkAction *action = l->data;
       GSList *p, *proxies = gtk_action_get_proxies (action);
+      GSList *proxies_copy;
 
       /* Remove MenuItems */
-      for (p = proxies; p; p = g_slist_next (p))
-        if (GTK_IS_MENU_ITEM (p->data)) gtk_widget_destroy (p->data);
+      proxies_copy = g_slist_copy (proxies);
+      for (p = proxies_copy; p; p = g_slist_next (p))
+        if (GTK_IS_MENU_ITEM (p->data))
+         gtk_widget_destroy (p->data);
+      g_slist_free (proxies_copy);
 
       g_signal_handlers_disconnect_by_func (action,
                                             G_CALLBACK (projects_list_menu_activate_cb),


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