How to solve widget 2 containers can't work together?

Description

I create 2 containers.

The first container has image widget inside.
The second container has 2 label widgets inside.

If I create the first container only, it can run properly.
If I create the second container only, it can run properly.

However when put them together, it occurs runtime-error.
How to solve it?

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

ESP32

What LVGL version are you using?

I use lvgl 7.0dev version ( old style like lvgl6.0)

What do you want to achieve?

How to solve the 2 containers can’t run togother?

What have you tried so far?

Code to reproduce

void cont_image_create(){
  static  lv_style_t style_cont_image;
  lv_obj_t* cont_image;
  lv_obj_t* image;
  
  lv_style_copy(&style_cont_image, &lv_style_plain);
    style_cont_image.body.opa           = 0;
    style_cont_image.body.border.width  = 0;

  cont_image = lv_cont_create(lv_scr_act(), NULL);
  lv_cont_set_fit(cont_image, LV_FIT_TIGHT);
  lv_obj_set_style(cont_image, &style_cont_image);

  LV_IMG_DECLARE(pic_ironman);
  image = lv_img_create(cont_image, NULL);
  lv_img_set_src(image, &pic_ironman );
  
  lv_obj_align(cont_image, NULL, LV_ALIGN_CENTER, 0,0);
}


void cont_text_create(){
  static lv_style_t style_cont_text;
  lv_obj_t* cont_text;
  lv_obj_t* label1;
  lv_obj_t* label2;
  
  lv_style_copy(&style_cont_text, &lv_style_plain);
    style_cont_text.body.opa           = 0;
    style_cont_text.body.border.width  = 20;
    style_cont_text.body.border.color  = LV_COLOR_ORANGE;
    style_cont_text.body.border.part   = LV_BORDER_PART_LEFT;
    style_cont_text.body.radius        = 0;
    style_cont_text.body.padding.left  = 30;
    style_cont_text.text.color         = LV_COLOR_WHITE;
    
  cont_text = lv_cont_create(lv_scr_act(), NULL);
  lv_cont_set_layout(cont_text, LV_LAYOUT_OFF);
  lv_cont_set_fit(cont_text, LV_FIT_TIGHT);
  lv_obj_set_style(cont_text, &style_cont_text);
  
  label1 = lv_label_create(cont_text, NULL);
  label2 = lv_label_create(cont_text, NULL);
  
  lv_label_set_text(label1, "Iron Man");
  lv_label_set_text(label2, "Adventure");
  
  lv_obj_align(label1, NULL, LV_ALIGN_IN_TOP_LEFT, style_cont_text.body.border.width + style_cont_text.body.padding.left, 0);
  lv_obj_align(label2, label1, LV_ALIGN_OUT_BOTTOM_LEFT, 0,-15);

  lv_obj_align(cont_text, NULL, LV_ALIGN_CENTER, 0,0);
}


void setup() {
  Serial.begin(115200); Serial.println();
  
  ...... lvgl initialize  ....

  cont_image_create();    // can run properly
  cont_text_create();        // can run properly  but if put them together, it occurs runtime error.
}

Runtime Errors

When I looked at rumtime error’s stack, it occurs at

lv_mem_free in lv_mem_realloc at lv_mem.c

Sorry. Already solved , I don’t know how . But it’s fine now.

This isn’t really related to your post itself, but it’s worth noting that even the official 7.0 release was relatively unstable, given the number of bugs fixed by 7.1 and 7.2. However, I see that you are trying to use the new rendering system with the old styles.