summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorChristian Soffke <christian.soffke@gmail.com>2021-11-10 19:56:19 +0100
committerChristian Soffke <christian.soffke@gmail.com>2021-11-10 19:56:19 +0100
commit687096e3f5b3207d2ced3b595315e10b1abb3936 (patch)
treeb1d06ac8656647d3bd6a1c80b73ca2e38ae223be
parent9ee321cf902c9828b969c05bd96c79495bf2b96c (diff)
downloadrockbox-687096e3f5b3207d2ced3b595315e10b1abb3936.tar.gz
rockbox-687096e3f5b3207d2ced3b595315e10b1abb3936.zip
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
-rw-r--r--apps/shortcuts.c14
1 files changed, 14 insertions, 0 deletions
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)
236 write(fd, buf, len); 236 write(fd, buf, len);
237 if (sc->type == SHORTCUT_SETTING) 237 if (sc->type == SHORTCUT_SETTING)
238 write(fd, sc->u.setting->cfg_name, strlen(sc->u.setting->cfg_name)); 238 write(fd, sc->u.setting->cfg_name, strlen(sc->u.setting->cfg_name));
239 else if (sc->type == SHORTCUT_TIME)
240 {
241#if CONFIG_RTC
242 if (sc->u.timedata.talktime)
243 write(fd, "talk", 4);
244 else
245#endif
246 {
247 write(fd, "sleep ", 6);
248 len = snprintf(buf, MAX_PATH, "%d", sc->u.timedata.sleep_timeout);
249 write(fd, buf, len);
250 }
251 }
239 else 252 else
240 write(fd, sc->u.path, strlen(sc->u.path)); 253 write(fd, sc->u.path, strlen(sc->u.path));
241 254
@@ -599,6 +612,7 @@ int do_shortcut_menu(void *ignored)
599 612
600 while (done == GO_TO_PREVIOUS) 613 while (done == GO_TO_PREVIOUS)
601 { 614 {
615 list.count = shortcut_count;
602 if (simplelist_show_list(&list)) 616 if (simplelist_show_list(&list))
603 break; /* some error happened?! */ 617 break; /* some error happened?! */
604 if (list.selection == -1) 618 if (list.selection == -1)