Fix return to main when setting an autoboot option

This fixes the issue with "More configs".
This commit is contained in:
Kostas Missos 2018-12-16 20:21:59 +02:00
parent 98d715243a
commit 9f5b97620a
3 changed files with 11 additions and 8 deletions

View file

@ -156,7 +156,7 @@ int create_config_entry()
return 0;
}
void _config_autoboot_list()
static void _config_autoboot_list(void *ent)
{
gfx_clear_grey(&gfx_ctxt, 0x1B);
gfx_con_setpos(&gfx_con, 0, 0);
@ -231,6 +231,9 @@ void _config_autoboot_list()
else
EPRINTF("\nConfiguration saving failed!");
gfx_puts(&gfx_con, "\nPress any key...");
ment_t *tmp = (ment_t *)ent;
tmp->data = NULL;
}
else
goto out2;
@ -251,9 +254,6 @@ out2:;
ini_free(&ini_sections);
sd_unmount();
if (temp_autoboot == NULL)
return;
}
void config_autoboot()
@ -291,13 +291,13 @@ void config_autoboot()
ments[2].caption = " Disable";
ments[2].data = &boot_values[0];
ments[3].type = MENT_HANDLER;
ments[3].type = MENT_HDLR_RE;
if (h_cfg.autoboot_list)
ments[3].caption = "*More configs...";
else
ments[3].caption = " More configs...";
ments[3].handler = _config_autoboot_list;
ments[3].data = NULL;
ments[3].data = (void *)0xCAFE;
ments[4].type = MENT_CHGLINE;

View file

@ -322,6 +322,7 @@ void menu_autorcm()
ments[4].handler = _disable_autorcm;
}
ments[4].type = MENT_HDLR_RE;
ments[4].data = NULL;
memset(&ments[5], 0, sizeof(ment_t));
menu_t menu = {ments, "This corrupts your BOOT0!", 0, 0};

View file

@ -206,8 +206,10 @@ void *tui_do_menu(gfx_con_t *con, menu_t *menu)
return NULL;
break;
case MENT_HDLR_RE:
ent->handler(ent->data);
return NULL;
ent->handler(ent);
if (!ent->data)
return NULL;
break;
default:
break;
}