Fix: Shortcuts Menu data loss & crash

- Shortcuts Menu would delete SHORTCUT_TIME shortcuts
when deleting any other shortcut.

- Shortcuts would crash or show wrong number of items
after deleting a shortcut and then launching a shortcut
when simplelist_show_list was executed again.

Change-Id: Ia87c94a364c516fd662cb3c7d245c566a3fa91ca
This commit is contained in:
Christian Soffke 2021-11-10 19:56:19 +01:00
parent 9ee321cf90
commit 687096e3f5

View file

@ -236,6 +236,19 @@ static void shortcuts_ata_idle_callback(void)
write(fd, buf, len);
if (sc->type == SHORTCUT_SETTING)
write(fd, sc->u.setting->cfg_name, strlen(sc->u.setting->cfg_name));
else if (sc->type == SHORTCUT_TIME)
{
#if CONFIG_RTC
if (sc->u.timedata.talktime)
write(fd, "talk", 4);
else
#endif
{
write(fd, "sleep ", 6);
len = snprintf(buf, MAX_PATH, "%d", sc->u.timedata.sleep_timeout);
write(fd, buf, len);
}
}
else
write(fd, sc->u.path, strlen(sc->u.path));
@ -599,6 +612,7 @@ int do_shortcut_menu(void *ignored)
while (done == GO_TO_PREVIOUS)
{
list.count = shortcut_count;
if (simplelist_show_list(&list))
break; /* some error happened?! */
if (list.selection == -1)