[Xfce4-commits] <mousepad:master> Prevent segfault when opening more that 100 files.
Matthew Brush
noreply at xfce.org
Sat May 5 21:31:51 CEST 2012
Updating branch refs/heads/master
to 52e5c6a0051cd456802d6b50b85b9190a33d62cf (commit)
from b401a34b8c6b88ebd26e26f03a70a13548cbc4c0 (commit)
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 b84ab6c..b14dabe 100644
--- a/mousepad/mousepad-window.c
+++ b/mousepad/mousepad-window.c
@@ -2144,9 +2144,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);
@@ -2164,14 +2164,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