Fix item selection after element subgroups have been removed

If the element currently selected is removed due to inactivity, the
selection is fixed up to the previous element in the list. This step
must be done after the entire element subgroup has been removed.

Signed-off-by: Thomas Graf <tgraf@suug.ch>
This commit is contained in:
Thomas Graf 2016-08-02 12:05:29 +02:00
parent 86f6da0703
commit 7317715e15

View File

@ -201,12 +201,6 @@ void element_free(struct element *e)
struct attr *a, *an;
int i;
if (e->e_group->g_current == e) {
element_select_prev();
if (e->e_group->g_current == e)
e->e_group->g_current = NULL;
}
list_for_each_entry_safe(c, cnext, &e->e_childs, e_list)
element_free(c);
@ -221,6 +215,12 @@ void element_free(struct element *e)
list_for_each_entry_safe(a, an, &e->e_attrhash[i], a_list)
attr_free(a);
if (e->e_group->g_current == e) {
element_select_prev();
if (e->e_group->g_current == e)
e->e_group->g_current = NULL;
}
list_del(&e->e_list);
e->e_group->g_nelements--;