1
0
mirror of https://github.com/lvgl/lvgl.git synced 2025-01-21 06:53:01 +08:00

Prevent crash when lv_init is called more than once. After the first call, it will do nothing.

This commit is contained in:
Amir Gonnen 2019-02-08 00:03:16 +02:00
parent b0b1174564
commit e72589c6d4

View File

@ -49,6 +49,8 @@ static lv_res_t lv_obj_signal(lv_obj_t * obj, lv_signal_t sign, void * param);
* STATIC VARIABLES
**********************/
static bool _lv_initialized = false;
/**********************
* MACROS
**********************/
@ -62,6 +64,9 @@ static lv_res_t lv_obj_signal(lv_obj_t * obj, lv_signal_t sign, void * param);
*/
void lv_init(void)
{
if (_lv_initialized) return;
_lv_initialized = true;
LV_GC_ROOT(_lv_def_scr) = NULL;
LV_GC_ROOT(_lv_act_scr) = NULL;
LV_GC_ROOT(_lv_top_layer) = NULL;