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:
@@ -67,6 +67,7 @@ struct _lv_freetype_context_t;
|
|||||||
|
|
||||||
typedef struct _lv_global_t {
|
typedef struct _lv_global_t {
|
||||||
bool inited;
|
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;
|
lv_ll_t disp_ll;
|
||||||
struct _lv_display_t * disp_refresh;
|
struct _lv_display_t * disp_refresh;
|
||||||
|
|||||||
@@ -11,6 +11,7 @@
|
|||||||
#include <stdbool.h>
|
#include <stdbool.h>
|
||||||
#include "../../core/lv_refr.h"
|
#include "../../core/lv_refr.h"
|
||||||
#include "../../stdlib/lv_string.h"
|
#include "../../stdlib/lv_string.h"
|
||||||
|
#include "../../core/lv_global.h"
|
||||||
|
|
||||||
#define SDL_MAIN_HANDLED /*To fix SDL's "undefined reference to WinMain" issue*/
|
#define SDL_MAIN_HANDLED /*To fix SDL's "undefined reference to WinMain" issue*/
|
||||||
#include LV_SDL_INCLUDE_PATH
|
#include LV_SDL_INCLUDE_PATH
|
||||||
@@ -63,6 +64,8 @@ static bool inited = false;
|
|||||||
**********************/
|
**********************/
|
||||||
static lv_timer_t * event_handler_timer;
|
static lv_timer_t * event_handler_timer;
|
||||||
|
|
||||||
|
#define lv_deinit_in_progress LV_GLOBAL_DEFAULT()->deinit_in_progress
|
||||||
|
|
||||||
/**********************
|
/**********************
|
||||||
* MACROS
|
* MACROS
|
||||||
**********************/
|
**********************/
|
||||||
@@ -359,6 +362,10 @@ static void res_chg_event_cb(lv_event_t * e)
|
|||||||
|
|
||||||
static void release_disp_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_display_t * disp = (lv_display_t *) lv_event_get_user_data(e);
|
||||||
|
|
||||||
lv_sdl_window_t * dsc = lv_display_get_driver_data(disp);
|
lv_sdl_window_t * dsc = lv_display_get_driver_data(disp);
|
||||||
|
|||||||
@@ -37,6 +37,7 @@
|
|||||||
* DEFINES
|
* DEFINES
|
||||||
*********************/
|
*********************/
|
||||||
#define lv_initialized LV_GLOBAL_DEFAULT()->inited
|
#define lv_initialized LV_GLOBAL_DEFAULT()->inited
|
||||||
|
#define lv_deinit_in_progress LV_GLOBAL_DEFAULT()->deinit_in_progress
|
||||||
|
|
||||||
/**********************
|
/**********************
|
||||||
* TYPEDEFS
|
* TYPEDEFS
|
||||||
@@ -296,6 +297,8 @@ void lv_deinit(void)
|
|||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
lv_deinit_in_progress = true;
|
||||||
|
|
||||||
#if LV_USE_SYSMON
|
#if LV_USE_SYSMON
|
||||||
_lv_sysmon_builtin_deinit();
|
_lv_sysmon_builtin_deinit();
|
||||||
#endif
|
#endif
|
||||||
|
|||||||
Reference in New Issue
Block a user