1
0
mirror of https://github.com/lvgl/lvgl.git synced 2025-01-28 07:03:00 +08:00

feat(init): add deinit_in_progress to lv_globals

With this in LV_EVENT_DELETE displays and indevs can deinit the drivers too
This commit is contained in:
Gabor Kiss-Vamosi 2023-11-21 20:12:13 +01:00
parent 0c8a1f22a4
commit 1d5dd3c2f3
3 changed files with 11 additions and 0 deletions

View File

@ -67,6 +67,7 @@ struct _lv_freetype_context_t;
typedef struct _lv_global_t {
bool inited;
bool deinit_in_progress; /**< Can be used e.g. in the LV_EVENT_DELETE to deinit the drivers too */
lv_ll_t disp_ll;
struct _lv_display_t * disp_refresh;

View File

@ -11,6 +11,7 @@
#include <stdbool.h>
#include "../../core/lv_refr.h"
#include "../../stdlib/lv_string.h"
#include "../../core/lv_global.h"
#define SDL_MAIN_HANDLED /*To fix SDL's "undefined reference to WinMain" issue*/
#include LV_SDL_INCLUDE_PATH
@ -63,6 +64,8 @@ static bool inited = false;
**********************/
static lv_timer_t * event_handler_timer;
#define lv_deinit_in_progress LV_GLOBAL_DEFAULT()->deinit_in_progress
/**********************
* MACROS
**********************/
@ -359,6 +362,10 @@ static void res_chg_event_cb(lv_event_t * e)
static void release_disp_cb(lv_event_t * e)
{
if(lv_deinit_in_progress) {
lv_sdl_quit();
}
lv_display_t * disp = (lv_display_t *) lv_event_get_user_data(e);
lv_sdl_window_t * dsc = lv_display_get_driver_data(disp);

View File

@ -37,6 +37,7 @@
* DEFINES
*********************/
#define lv_initialized LV_GLOBAL_DEFAULT()->inited
#define lv_deinit_in_progress LV_GLOBAL_DEFAULT()->deinit_in_progress
/**********************
* TYPEDEFS
@ -296,6 +297,8 @@ void lv_deinit(void)
return;
}
lv_deinit_in_progress = true;
#if LV_USE_SYSMON
_lv_sysmon_builtin_deinit();
#endif