Cannot delete child of parent of object

Description

I am trying to list scanned wifi networks and update the list when connected to wifi. I have created an object as parent and its children are the list of available wifi networks. i used lv_obj_clean() to clean the children (list of wifi networks ) to update the list after connecting to wifi. it works fine in normal condition. But when I revisit this screen 2nd time , i get error when in lv_obj_clean() and the system reboots.

After creating parent object, the system checks it has at least one child. If true, all the children are deleted. This is done to avoid new list(without wifi network ssid) to append the current list i the screen after wifi connection. Then, the list is diplayed in the screen.

Guru Meditation Error: Core  0 panic'ed (LoadProhibited). Exception was unhandled.

Core  0 register dump:
PC      : 0x4011579e  PS      : 0x00060f30  A0      : 0x801182b4  A1      : 0x3ffd0bb0  
A2      : 0x3ffb99cc  A3      : 0x3ffb926c  A4      : 0x00000021  A5      : 0x3ffb99cc  
A6      : 0x00000021  A7      : 0x00000000  A8      : 0x0000000c  A9      : 0x80115781  
A10     : 0x3ffb5ac4  A11     : 0x3ffb926c  A12     : 0x3ffb927c  A13     : 0x0000ff00  
A14     : 0x00ff0000  A15     : 0xff000000  SAR     : 0x0000001d  EXCCAUSE: 0x0000001c  
EXCVADDR: 0x00000010  LBEG    : 0x400013f9  LEND    : 0x4000140d  LCOUNT  : 0xfffffffc  

Backtrace:0x4011579b:0x3ffd0bb0 0x401182b1:0x3ffd0bd0 0x401b2ae3:0x3ffd0bf0 0x401b2af1:0x3ffd0c10 0x4011c744:0x3ffd0c30 0x4011c6d9:0x3ffd0c50 0x4011c868:0x3ffd0c70 0x400d3162:0x3ffd0c90 0x400d3457:0x3ffd0eb0 0x401156ed:0x3ffd0ed0 0x4011577e:0x3ffd0ef0 0x40117e71:0x3ffd0f30 0x401b2881:0x3ffd0f50 0x4012b08b:0x3ffd0f70 0x401b2881:0x3ffd0f90 0x401156cb:0x3ffd0fb0 0x4011577e:0x3ffd0fd0 0x401159bb:0x3ffd1010 0x4011676a:0x3ffd1030 0x4011686d:0x3ffd1050 0x40126c81:0x3ffd1090 0x40126d2a:0x3ffd10b0 0x400d2701:0x3ffd10d0 0x4008c9dd:0x3ffd1130
  #0  0x4011579b:0x3ffd0bb0 in _lv_event_mark_deleted at components/lvgl/src/core/lv_event.c:147
  #1  0x401182b1:0x3ffd0bd0 in lv_obj_destructor at components/lvgl/src/core/lv_obj.c:409
  #2  0x401b2ae3:0x3ffd0bf0 in _lv_obj_destruct at components/lvgl/src/core/lv_obj_class.c:131 (discriminator 1)
  #3  0x401b2af1:0x3ffd0c10 in _lv_obj_destruct at components/lvgl/src/core/lv_obj_class.c:138
  #4  0x4011c744:0x3ffd0c30 in obj_del_core at components/lvgl/src/core/lv_obj_tree.c:372
  #5  0x4011c6d9:0x3ffd0c50 in obj_del_core at components/lvgl/src/core/lv_obj_tree.c:349
  #6  0x4011c868:0x3ffd0c70 in lv_obj_clean at components/lvgl/src/core/lv_obj_tree.c:94
  #7  0x400d3162:0x3ffd0c90 in update_wifi_list at src/ui/display_settings_wifi.c:203 (discriminator 6)
  #8  0x400d3457:0x3ffd0eb0 in wifi_switch_event_cb at src/ui/display_settings_wifi.c:333
  #9  0x401156ed:0x3ffd0ed0 in event_send_core at components/lvgl/src/core/lv_event.c:436
  #10 0x4011577e:0x3ffd0ef0 in lv_event_send at components/lvgl/src/core/lv_event.c:74
  #11 0x40117e71:0x3ffd0f30 in lv_obj_event at components/lvgl/src/core/lv_obj.c:685
  #12 0x401b2881:0x3ffd0f50 in lv_obj_event_base at components/lvgl/src/core/lv_event.c:101
  #13 0x4012b08b:0x3ffd0f70 in lv_switch_event at components/lvgl/src/widgets/lv_switch.c:93
  #14 0x401b2881:0x3ffd0f90 in lv_obj_event_base at components/lvgl/src/core/lv_event.c:101
  #15 0x401156cb:0x3ffd0fb0 in event_send_core at components/lvgl/src/core/lv_event.c:428
  #16 0x4011577e:0x3ffd0fd0 in lv_event_send at components/lvgl/src/core/lv_event.c:74
  #17 0x401159bb:0x3ffd1010 in indev_proc_release at components/lvgl/src/core/lv_indev.c:927
  #18 0x4011676a:0x3ffd1030 in indev_pointer_proc at components/lvgl/src/core/lv_indev.c:363
  #19 0x4011686d:0x3ffd1050 in lv_indev_read_timer_cb at components/lvgl/src/core/lv_indev.c:100
  #20 0x40126c81:0x3ffd1090 in lv_timer_exec at components/lvgl/src/misc/lv_timer.c:315 (discriminator 2)
  #21 0x40126d2a:0x3ffd10b0 in lv_timer_handler at components/lvgl/src/misc/lv_timer.c:106
  #22 0x400d2701:0x3ffd10d0 in lv_task_handler at components/lvgl/src/lv_api_map.h:37
      (inlined by) display_task at src/ui/display_main.c:249
  #23 0x4008c9dd:0x3ffd1130 in vPortTaskWrapper at /home/bikash/.platformio/packages/framework-espidf@3.40300.0/components/freertos/port/xtensa/port.c:168


ELF file SHA256: 0c401e5dca14d1e9

Rebooting...
ets Jun  8 2016 00:22:57

rst:0xc (SW_CPU_RESET),boot:0x13 (SPI_FAST_FLASH_BOOT)
configsip: 0, SPIWP:0xee
clk_drv:0x00,q_drv:0x00,d_drv:0x00,cs0_drv:0x00,hd_drv:0x00,wp_drv:0x00
mode:DIO, clock div:2
load:0x3fff0030,len:7220
load:0x40078000,len:14292
load:0x40080400,len:3688
entry 0x40080678

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

ESP32

What LVGL version are you using?

8.0.0

What do you want to achieve?

show the list of available wifi networks after wifi connection

What have you tried so far?

I tried to delete the parent object as well using lv_obj_del() but getiting same error at same place

Code to reproduce

I have added sample on how i created and deleted objects .

lv_obj_t  *wifi_lister_obj, *wifi_obj, *wifi_label;
char updated_wifi_display_list[7][50];

wifi_lister_obj = lv_obj_create(lv_scr_sct());

if(lv_obj_get_child_cnt(wifi_lister_obj) >0)
{
       lv_obj_clean(wifi_lister_obj);
}

for(int i= 0; i<7;i++)
{
    wifi_obj = lv_btn_create(wifi_lister_obj);
   
   label = lv_label_create(wifi_obj);
   lv_label_set_text_fmt(label, "%s", updated_wifi_display_list[i]);
}


Do it this way:
lv_obj_del(wifi_lister_obj);
wifi_lister_obj = NULL;

Already tried this but got same result :pensive: