Lv_obj_clean(lv_scr_act()) causes Segmentation fault


lv_obj_clean(lv_scr_act()) causes Segmentation fault

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

Linux FB

What do you want to achieve?

Clear screen before each tutorial

What have you tried so far?

Code to reproduce


This is inside the while loop inside block if (usCounter++ % 1000 == 0) to change tutorial every 5 seconds.

Screenshot and/or video

If possible, add screenshots and/or videos about the current state.

I’ve just fixed it in the master branch of lvgl.

However note that, lv_tutorial_objects creates and loads a new screen which won’t be deleted by lv_obj_clean. A proper close function would solve it, but tutorials and examples will be reworked in the next release. I’ll take care to do it correctly in the new version.

1 Like

Many thanks, it’s much better. It still seg faults after lv_tutorial_objects() and lv_test_stress_1() as you say.


say I have a pointer on the stack to the screen on the heap.

`lv_obj_t* screen;
lv_obj_t* stuff;
stuff = lv_obj_create(screen);

In what case could lv_obj_clean(screen) ever cause a seg fault ? Should lv_obj_clean not iterate through the linked list of allocated objects (children) ? It sometimes causes a seg fault in my app, cause a child is allegedly not there anymore. The only cause I could think of would be a multi-thread sync issue, but I use mutexes before accessing lvgl.
Could there be any other cause than a sync issue ?

Thanks (maybe I should create a new thread, but it is the exact same topic) :slight_smile: