Error when setting multiple properties in a style


When I try to initialize a style within a class I get a cpu panic error. The class GUI handles the initializing of the library and drawing of the screen. The guiproperties (singleton) has a pointer to a Skin class, a child implementation of this Skin class has public members lv_style_t and tries to lv_style_init those in it’s constructor.

What MCU/Processor/Board and compiler are you using?

Esp32 with ESP-idf
LVGL v8.2.0

What do you want to achieve?

I’d like to initialize the styles and set some properties so I can retreive (get function called from gui to implementation of skin) and apply them on objects.

What have you tried so far?

Putting the styles as static in the skin implementation class. Dynamically allocating them within the skin implementation class.
Only setting 1 property of the style and then retreiving it in the gui class, this does work, i can even do this with 2 styles from the skin implementation class. Just setting multiple properties of 1 style does not work.

Code to reproduce

void Skin::initRegularLabel()
    regularLabel = new lv_style_t;  //This is a public member of class skin, just trying to dynamically allocate now
    lv_style_set_text_font(regularLabel, regularLabelFont);
    lv_style_set_text_color(regularLabel, defaultTextColor); //Crashes on this line

skinImplementation::skinImplementation() : Skin::Skin()
    defaultTextColor = lv_color_hex(0xff0000);
    regularLabelFont = &openSans_18_pt;

Bit strange to use new for lv_style_t lvgl is a C library I should not mix it with C++ new and delete.

Hi, I’ve done this as a last resort to try and dynamically allocate the styles since that is possible aswell according to documentation. Previously I called lv_style_init() in the constructor for all the needed styles to allocate space.

I seem to have fixed this by going into menuconfig and using the default c memalloc functions instead of the lvgl custom functions.