From 9192520c7096a9ff673c8bfbdd75abb71e4c7e7c Mon Sep 17 00:00:00 2001 From: Sergey Gavrilov Date: Tue, 27 Dec 2022 05:46:05 +1000 Subject: [PATCH] Modules: locking view model (#2189) MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit * Popup, dialog_ex: locking model * Desktop: do not use the model where it is not needed Co-authored-by: あく --- applications/services/desktop/views/desktop_view_main.c | 1 - .../services/desktop/views/desktop_view_pin_setup_done.c | 3 +-- applications/services/gui/modules/dialog_ex.c | 2 +- applications/services/gui/modules/popup.c | 2 +- .../views/desktop_settings_view_pin_setup_howto.c | 3 +-- .../views/desktop_settings_view_pin_setup_howto2.c | 3 +-- 6 files changed, 5 insertions(+), 9 deletions(-) diff --git a/applications/services/desktop/views/desktop_view_main.c b/applications/services/desktop/views/desktop_view_main.c index cbf4a20f..7d956489 100644 --- a/applications/services/desktop/views/desktop_view_main.c +++ b/applications/services/desktop/views/desktop_view_main.c @@ -102,7 +102,6 @@ DesktopMainView* desktop_main_alloc() { DesktopMainView* main_view = malloc(sizeof(DesktopMainView)); main_view->view = view_alloc(); - view_allocate_model(main_view->view, ViewModelTypeLockFree, 1); view_set_context(main_view->view, main_view); view_set_input_callback(main_view->view, desktop_main_input_callback); diff --git a/applications/services/desktop/views/desktop_view_pin_setup_done.c b/applications/services/desktop/views/desktop_view_pin_setup_done.c index 1d82aeaa..561b1286 100644 --- a/applications/services/desktop/views/desktop_view_pin_setup_done.c +++ b/applications/services/desktop/views/desktop_view_pin_setup_done.c @@ -18,7 +18,7 @@ struct DesktopViewPinSetupDone { static void desktop_view_pin_done_draw(Canvas* canvas, void* model) { furi_assert(canvas); - furi_assert(model); + UNUSED(model); canvas_set_font(canvas, FontPrimary); elements_multiline_text_aligned( @@ -59,7 +59,6 @@ void desktop_view_pin_done_set_callback( DesktopViewPinSetupDone* desktop_view_pin_done_alloc() { DesktopViewPinSetupDone* view = malloc(sizeof(DesktopViewPinSetupDone)); view->view = view_alloc(); - view_allocate_model(view->view, ViewModelTypeLockFree, 1); view_set_context(view->view, view); view_set_draw_callback(view->view, desktop_view_pin_done_draw); view_set_input_callback(view->view, desktop_view_pin_done_input); diff --git a/applications/services/gui/modules/dialog_ex.c b/applications/services/gui/modules/dialog_ex.c index 1cb46723..7c3ef9b4 100644 --- a/applications/services/gui/modules/dialog_ex.c +++ b/applications/services/gui/modules/dialog_ex.c @@ -147,7 +147,7 @@ DialogEx* dialog_ex_alloc() { DialogEx* dialog_ex = malloc(sizeof(DialogEx)); dialog_ex->view = view_alloc(); view_set_context(dialog_ex->view, dialog_ex); - view_allocate_model(dialog_ex->view, ViewModelTypeLockFree, sizeof(DialogExModel)); + view_allocate_model(dialog_ex->view, ViewModelTypeLocking, sizeof(DialogExModel)); view_set_draw_callback(dialog_ex->view, dialog_ex_view_draw_callback); view_set_input_callback(dialog_ex->view, dialog_ex_view_input_callback); with_view_model( diff --git a/applications/services/gui/modules/popup.c b/applications/services/gui/modules/popup.c index 08e8d8c2..d75abb95 100644 --- a/applications/services/gui/modules/popup.c +++ b/applications/services/gui/modules/popup.c @@ -117,7 +117,7 @@ Popup* popup_alloc() { popup->timer_enabled = false; view_set_context(popup->view, popup); - view_allocate_model(popup->view, ViewModelTypeLockFree, sizeof(PopupModel)); + view_allocate_model(popup->view, ViewModelTypeLocking, sizeof(PopupModel)); view_set_draw_callback(popup->view, popup_view_draw_callback); view_set_input_callback(popup->view, popup_view_input_callback); view_set_enter_callback(popup->view, popup_start_timer); diff --git a/applications/settings/desktop_settings/views/desktop_settings_view_pin_setup_howto.c b/applications/settings/desktop_settings/views/desktop_settings_view_pin_setup_howto.c index 3831be8c..26aa7c3e 100644 --- a/applications/settings/desktop_settings/views/desktop_settings_view_pin_setup_howto.c +++ b/applications/settings/desktop_settings/views/desktop_settings_view_pin_setup_howto.c @@ -17,7 +17,7 @@ struct DesktopSettingsViewPinSetupHowto { static void desktop_settings_view_pin_setup_howto_draw(Canvas* canvas, void* model) { furi_assert(canvas); - furi_assert(model); + UNUSED(model); canvas_draw_icon(canvas, 16, 18, &I_Pin_attention_dpad_29x29); elements_button_right(canvas, "Next"); @@ -57,7 +57,6 @@ void desktop_settings_view_pin_setup_howto_set_callback( DesktopSettingsViewPinSetupHowto* desktop_settings_view_pin_setup_howto_alloc() { DesktopSettingsViewPinSetupHowto* view = malloc(sizeof(DesktopSettingsViewPinSetupHowto)); view->view = view_alloc(); - view_allocate_model(view->view, ViewModelTypeLockFree, 1); view_set_context(view->view, view); view_set_draw_callback(view->view, desktop_settings_view_pin_setup_howto_draw); view_set_input_callback(view->view, desktop_settings_view_pin_setup_howto_input); diff --git a/applications/settings/desktop_settings/views/desktop_settings_view_pin_setup_howto2.c b/applications/settings/desktop_settings/views/desktop_settings_view_pin_setup_howto2.c index ab1fa238..c28826e6 100644 --- a/applications/settings/desktop_settings/views/desktop_settings_view_pin_setup_howto2.c +++ b/applications/settings/desktop_settings/views/desktop_settings_view_pin_setup_howto2.c @@ -18,7 +18,7 @@ struct DesktopSettingsViewPinSetupHowto2 { static void desktop_settings_view_pin_setup_howto2_draw(Canvas* canvas, void* model) { furi_assert(canvas); - furi_assert(model); + UNUSED(model); canvas_set_font(canvas, FontSecondary); elements_multiline_text_aligned( @@ -79,7 +79,6 @@ void desktop_settings_view_pin_setup_howto2_set_ok_callback( DesktopSettingsViewPinSetupHowto2* desktop_settings_view_pin_setup_howto2_alloc() { DesktopSettingsViewPinSetupHowto2* view = malloc(sizeof(DesktopSettingsViewPinSetupHowto2)); view->view = view_alloc(); - view_allocate_model(view->view, ViewModelTypeLockFree, 1); view_set_context(view->view, view); view_set_draw_callback(view->view, desktop_settings_view_pin_setup_howto2_draw); view_set_input_callback(view->view, desktop_settings_view_pin_setup_howto2_input);