mirror of
https://gitlab.gnome.org/GNOME/gimp.git
synced 2025-07-03 09:23:24 +00:00
app: fix #13288 crash when opening a recently closed dock
When at least 3 recently closed docks were present in the Windows -> Recently Closed Docks submenu, then clicking the middle one caused a crash. Clicking the top or bottom one didn't cause a crash, but the submenu was then removed so the other closed docks were not visible anymore (until restarting GIMP). It turns out we were removing the whole recent menu, instead of picking the specific action that needed removing. So now we change this to get the action_name and use that in the remove call. Although this already fixes the crash, I added an extra check to make sure action is valid, and if not we generate a critical. This way we will notice something is wrong if this happens in the future, without causing a crash here.
This commit is contained in:
parent
9a3209844e
commit
257ac87e9f
2 changed files with 15 additions and 1 deletions
|
@ -265,5 +265,14 @@ windows_menu_recent_remove (GimpContainer *container,
|
|||
GimpSessionInfo *info,
|
||||
GimpUIManager *manager)
|
||||
{
|
||||
gimp_ui_manager_remove_uis (manager, "windows-recent-");
|
||||
gchar *action_name;
|
||||
gint info_id;
|
||||
|
||||
info_id = GPOINTER_TO_INT (g_object_get_data (G_OBJECT (info), "recent-action-id"));
|
||||
|
||||
action_name = g_strdup_printf ("windows-recent-%04d", info_id);
|
||||
|
||||
gimp_ui_manager_remove_uis (manager, action_name);
|
||||
|
||||
g_free (action_name);
|
||||
}
|
||||
|
|
|
@ -980,6 +980,11 @@ gimp_menu_model_get_item (GimpMenuModel *model,
|
|||
action = gimp_ui_manager_find_action (model->priv->manager, NULL,
|
||||
action_name);
|
||||
|
||||
if (! action)
|
||||
{
|
||||
g_critical ("Invalid action '%s'", action_name);
|
||||
continue;
|
||||
}
|
||||
if (gimp_action_is_visible (action))
|
||||
cur++;
|
||||
}
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue