From 92c499b41b72c1c516527a5d72ec46867dccdbfd Mon Sep 17 00:00:00 2001 From: gornekich Date: Wed, 24 Nov 2021 17:05:23 +0300 Subject: [PATCH] [FL-2049] Reset submenu index on exit #840 MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Co-authored-by: あく --- applications/loader/loader.c | 6 ++++++ 1 file changed, 6 insertions(+) diff --git a/applications/loader/loader.c b/applications/loader/loader.c index fb5133dfc..9d24f65d3 100644 --- a/applications/loader/loader.c +++ b/applications/loader/loader.c @@ -169,6 +169,9 @@ static uint32_t loader_hide_menu(void* context) { } static uint32_t loader_back_to_primary_menu(void* context) { + furi_assert(context); + Submenu* submenu = context; + submenu_set_selected_item(submenu, 0); return LoaderMenuViewPrimary; } @@ -200,6 +203,7 @@ static Loader* loader_alloc() { instance->view_dispatcher, LoaderMenuViewPrimary, menu_get_view(instance->primary_menu)); // Plugins menu instance->plugins_menu = submenu_alloc(); + view_set_context(submenu_get_view(instance->plugins_menu), instance->plugins_menu); view_set_previous_callback( submenu_get_view(instance->plugins_menu), loader_back_to_primary_menu); view_dispatcher_add_view( @@ -208,12 +212,14 @@ static Loader* loader_alloc() { submenu_get_view(instance->plugins_menu)); // Debug menu instance->debug_menu = submenu_alloc(); + view_set_context(submenu_get_view(instance->debug_menu), instance->debug_menu); view_set_previous_callback( submenu_get_view(instance->debug_menu), loader_back_to_primary_menu); view_dispatcher_add_view( instance->view_dispatcher, LoaderMenuViewDebug, submenu_get_view(instance->debug_menu)); // Settings menu instance->settings_menu = submenu_alloc(); + view_set_context(submenu_get_view(instance->settings_menu), instance->settings_menu); view_set_previous_callback( submenu_get_view(instance->settings_menu), loader_back_to_primary_menu); view_dispatcher_add_view(