Skip to content

Commit

Permalink
fix(theme): fix crash in lv_theme_basic_init
Browse files Browse the repository at this point in the history
  • Loading branch information
kisvegabor committed Jan 19, 2022
1 parent 933d67f commit ca5f04c
Show file tree
Hide file tree
Showing 2 changed files with 7 additions and 6 deletions.
12 changes: 6 additions & 6 deletions src/extra/themes/basic/lv_theme_basic.c
Original file line number Diff line number Diff line change
Expand Up @@ -16,9 +16,9 @@
/*********************
* DEFINES
*********************/
#define COLOR_SCR lv_palette_lighten(LV_PALETTE_GREY, 3)
#define COLOR_SCR lv_palette_lighten(LV_PALETTE_GREY, 4)
#define COLOR_WHITE lv_color_white()
#define COLOR_LIGHT lv_palette_lighten(LV_PALETTE_GREY, 1)
#define COLOR_LIGHT lv_palette_lighten(LV_PALETTE_GREY, 2)
#define COLOR_DARK lv_palette_main(LV_PALETTE_GREY)
#define COLOR_DIM lv_palette_darken(LV_PALETTE_GREY, 2)
#define SCROLLBAR_WIDTH 2
Expand Down Expand Up @@ -122,7 +122,7 @@ static void style_init(void)

bool lv_theme_basic_is_inited(void)
{
return LV_GC_ROOT(_lv_theme_default_styles) == NULL ? false : true;
return LV_GC_ROOT(_lv_theme_basic_styles) == NULL ? false : true;
}

lv_theme_t * lv_theme_basic_init(lv_disp_t * disp)
Expand All @@ -133,8 +133,8 @@ lv_theme_t * lv_theme_basic_init(lv_disp_t * disp)
*In a general case styles could be in simple `static lv_style_t my_style...` variables*/
if(!lv_theme_basic_is_inited()) {
inited = false;
LV_GC_ROOT(_lv_theme_default_styles) = lv_mem_alloc(sizeof(my_theme_styles_t));
styles = (my_theme_styles_t *)LV_GC_ROOT(_lv_theme_default_styles);
LV_GC_ROOT(_lv_theme_basic_styles) = lv_mem_alloc(sizeof(my_theme_styles_t));
styles = (my_theme_styles_t *)LV_GC_ROOT(_lv_theme_basic_styles);
}

theme.disp = disp;
Expand Down Expand Up @@ -257,7 +257,7 @@ static void theme_apply(lv_theme_t * th, lv_obj_t * obj)
#if LV_USE_SWITCH
else if(lv_obj_check_type(obj, &lv_switch_class)) {
lv_obj_add_style(obj, &styles->light, 0);
lv_obj_add_style(obj, &styles->dark, LV_PART_INDICATOR);
lv_obj_add_style(obj, &styles->dark, LV_PART_INDICATOR | LV_STATE_CHECKED);
lv_obj_add_style(obj, &styles->dim, LV_PART_KNOB);
}
#endif
Expand Down
1 change: 1 addition & 0 deletions src/misc/lv_gc.h
Original file line number Diff line number Diff line change
Expand Up @@ -57,6 +57,7 @@ extern "C" {
LV_DISPATCH_COND(f, _lv_draw_mask_radius_circle_dsc_arr_t , _lv_circle_cache, LV_DRAW_COMPLEX, 1) \
LV_DISPATCH_COND(f, _lv_draw_mask_saved_arr_t , _lv_draw_mask_list, LV_DRAW_COMPLEX, 1) \
LV_DISPATCH(f, void * , _lv_theme_default_styles) \
LV_DISPATCH(f, void * , _lv_theme_basic_styles) \
LV_DISPATCH_COND(f, uint8_t *, _lv_font_decompr_buf, LV_USE_FONT_COMPRESSED, 1) \
LV_DISPATCH(f, uint8_t * , _lv_grad_cache_mem)

Expand Down

0 comments on commit ca5f04c

Please sign in to comment.