From 01c3c56140880877a66bdd9375baea887da2103c Mon Sep 17 00:00:00 2001 From: sxmboer2 Date: Fri, 22 Jul 2022 16:05:32 +0300 Subject: [PATCH 1/2] Ticket #4391: fix infinite loop when deleting an mceditor macro. Signed-off-by: Andrew Borodin --- src/editor/editmacros.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/editor/editmacros.c b/src/editor/editmacros.c index 9b18f1f6a..7ce2a04e6 100644 --- a/src/editor/editmacros.c +++ b/src/editor/editmacros.c @@ -104,7 +104,7 @@ edit_delete_macro (WEdit * edit, int hotkey) char *skeyname; /* clear array of actions for current hotkey */ - while ((indx = edit_get_macro (edit, hotkey) != -1)) + while ((indx = edit_get_macro (edit, hotkey)) != -1) { macros_t *macros; From cca4c46d05aa6ea185d6e6501a258d2387032bfb Mon Sep 17 00:00:00 2001 From: sxmboer2 Date: Fri, 22 Jul 2022 16:08:34 +0300 Subject: [PATCH 2/2] (edit_delete_macro): do not resort macros after deleting one ...because g_array_remove_index() keeps the array sorted. Signed-off-by: Andrew Borodin --- src/editor/editmacros.c | 1 - 1 file changed, 1 deletion(-) diff --git a/src/editor/editmacros.c b/src/editor/editmacros.c index 7ce2a04e6..d95f84b5d 100644 --- a/src/editor/editmacros.c +++ b/src/editor/editmacros.c @@ -111,7 +111,6 @@ edit_delete_macro (WEdit * edit, int hotkey) macros = &g_array_index (macros_list, struct macros_t, indx); g_array_free (macros->macro, TRUE); g_array_remove_index (macros_list, indx); - edit_macro_sort_by_hotkey (); } macros_fname = mc_config_get_full_path (MC_MACRO_FILE);