Segmentation fault in lv_style.h

Hi everyone!
I’m using lvgl for a graphical application on Seeed reTerminal. I have a main.cpp file and a secondary file, called like my_lv_menu.cpp, in which I call the library my_lv_menu.h. The library contains all the useful includes, defines, prototypes and static variables used in the cpp.
main.cpp (which includes my_lv_menu.h) basically calls the function my_lv_menu (with its parameters) that builds the graphical interface, containing sliders, a tabview with tabs and various buttons. Then I call lv_timer_handler in a while(1) loop.
My problem is the following: when I build and start the application, it seems to go without problems, but just as I click a tabview button to change tab or try to move a slider, the application crashes, giving Segmentation Fault. Using debug I discovered that it gives seg fault in
file lv_style.h,
function static inline lv_res_t lv_style_get_prop_inline.
Sometimes in for loop at line 400 and sometimes at line 416 in if(props[i] == prop)

I cannot figure out what I’m doing wrong.
Thanks in advance for your help!

Are you sure the lv_style_t variables are not local? They should be static, global or dynamically allocated.

Yes, that was the problem, thank you for your help. There were a lot of other lv_style_t variables, all declared global and static. By debugging I discovered that there was only one local variable causing seg fault.

1 Like