From 687096e3f5b3207d2ced3b595315e10b1abb3936 Mon Sep 17 00:00:00 2001 From: Christian Soffke Date: Wed, 10 Nov 2021 19:56:19 +0100 Subject: [PATCH] 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 --- apps/shortcuts.c | 14 ++++++++++++++ 1 file changed, 14 insertions(+) diff --git a/apps/shortcuts.c b/apps/shortcuts.c index 7b224dde2f..443183934b 100644 --- a/apps/shortcuts.c +++ b/apps/shortcuts.c @@ -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)