chore(init): release indev and display automatically (#4793)

Signed-off-by: XiaoweiYan <yanxiaowei@xiaomi.com>
Co-authored-by: XiaoweiYan <yanxiaowei@xiaomi.com>
This commit is contained in:
bjsylvia
2023-11-13 15:23:30 +08:00
committed by GitHub
parent 9a9830671f
commit 3f8d56d0be
3 changed files with 31 additions and 12 deletions

View File

@@ -87,6 +87,17 @@ static inline void lv_global_init(lv_global_t * global)
#endif
}
static inline void _lv_cleanup_devices(lv_global_t * global)
{
LV_ASSERT_NULL(global);
if(global) {
/* cleanup indev and display */
_lv_ll_clear_custom(&(global->indev_ll), (void (*)(void *)) lv_indev_delete);
_lv_ll_clear_custom(&(global->disp_ll), (void (*)(void *)) lv_display_remove);
}
}
bool lv_is_initialized(void)
{
#if LV_ENABLE_GLOBAL_CUSTOM
@@ -274,7 +285,6 @@ void lv_deinit(void)
LV_LOG_WARN("lv_deinit: already deinit!");
return;
}
#if LV_ENABLE_GLOBAL_CUSTOM || LV_USE_STDLIB_MALLOC == LV_STDLIB_BUILTIN
#if LV_USE_SYSMON
_lv_sysmon_builtin_deinit();
@@ -282,6 +292,8 @@ void lv_deinit(void)
lv_display_set_default(NULL);
_lv_cleanup_devices(LV_GLOBAL_DEFAULT());
#if LV_USE_SPAN != 0
lv_span_stack_deinit();
#endif
@@ -350,15 +362,14 @@ void lv_deinit(void)
lv_mem_deinit();
lv_initialized = false;
LV_LOG_INFO("lv_deinit done");
#if LV_USE_LOG
lv_log_register_print_cb(NULL);
#endif
#endif
lv_initialized = false;
LV_LOG_INFO("lv_deinit done");
}
/**********************