[Xfce4-commits] <mousepad:matt/gtksourceview> Merge branch 'nick_0_3' into gtksourceview

Matthew Brush noreply at xfce.org
Thu Oct 6 23:20:12 CEST 2011


Updating branch refs/heads/matt/gtksourceview
         to 029bef60746206eaf08dc11c89afd59db186db8d (commit)
       from 05b3c46c8b9877fa62b07fd6a04b1b82fc5576ed (commit)

commit 029bef60746206eaf08dc11c89afd59db186db8d
Merge: 05b3c46 52e5c6a
Author: Matthew Brush <matt at xfce.org>
Date:   Thu Oct 6 04:05:33 2011 -0700

    Merge branch 'nick_0_3' into gtksourceview

commit 52e5c6a0051cd456802d6b50b85b9190a33d62cf
Author: Matthew Brush <matt at xfce.org>
Date:   Thu Oct 6 03:56:42 2011 -0700

    Prevent segfault when opening more that 100 files.
    
    Reported by Mark_T on #xfce-dev IRC.

 mousepad/mousepad-window.c |   14 +++++++-------
 1 files changed, 7 insertions(+), 7 deletions(-)

diff --git a/mousepad/mousepad-window.c b/mousepad/mousepad-window.c
index 5897108..118e7e9 100644
--- a/mousepad/mousepad-window.c
+++ b/mousepad/mousepad-window.c
@@ -2213,9 +2213,9 @@ mousepad_window_update_gomenu_idle (gpointer user_data)
   const gchar      *title;
   const gchar      *tooltip;
   gchar             accelerator[7];
-  GtkAction        *action;
   GtkRadioAction   *radio_action;
   GSList           *group = NULL;
+  GList            *actions, *iter;
 
   mousepad_return_val_if_fail (MOUSEPAD_IS_WINDOW (user_data), FALSE);
 
@@ -2233,14 +2233,14 @@ mousepad_window_update_gomenu_idle (gpointer user_data)
       gtk_ui_manager_remove_ui (window->ui_manager, window->gomenu_merge_id);
 
       /* drop all the old recent items from the menu */
-      for (n = 0; n < 100 /* arbitrary */; n++)
+      actions = gtk_action_group_list_actions (window->action_group);
+      for (iter = actions; iter != NULL; iter = g_list_next (iter))
         {
-          g_snprintf (name, sizeof (name), "mousepad-tab-%d", n);
-          action = gtk_action_group_get_action (window->action_group, name);
-          if (G_UNLIKELY (action == NULL))
-            break;
-          gtk_action_group_remove_action (window->action_group, action);
+          /* match only actions starting with "mousepad-tab-" */
+          if (g_str_has_prefix (gtk_action_get_name (iter->data), "mousepad-tab-"))
+            gtk_action_group_remove_action (window->action_group, iter->data);
         }
+      g_list_free (actions);
     }
 
   /* create a new merge id */


More information about the Xfce4-commits mailing list