From 17646cab372af747d627fd5d0879daa3fe1895eb Mon Sep 17 00:00:00 2001 From: Derek Jamison Date: Fri, 19 Apr 2024 18:14:21 -0500 Subject: [PATCH] JS: Fix widget sometimes MemCrash on exit. --- applications/system/js_app/modules/js_widget.c | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/applications/system/js_app/modules/js_widget.c b/applications/system/js_app/modules/js_widget.c index 830474d921..a27c55c1e0 100644 --- a/applications/system/js_app/modules/js_widget.c +++ b/applications/system/js_app/modules/js_widget.c @@ -917,9 +917,8 @@ static void widget_remove_view(void* context) { ComponentArray_it(it, model->component); while(!ComponentArray_end_p(it)) { WidgetComponent* component = *ComponentArray_ref(it); - if(component->free) { + if(component && component->free) { component->free(component); - component->free = NULL; } ComponentArray_next(it); } @@ -1003,6 +1002,7 @@ static void js_widget_destroy(void* inst) { view_dispatcher_stop(widget->view_dispatcher); widget_deinit(widget); } + widget_remove_view(widget); free(widget); }