Skip to content

layer->draw_task_head becomes corrupt after micropython garbage collect #410

Description

@JESteward

Please see https://github.com/lvgl/lvgl/issues/10338 for more details.

In short, a call to lv_timer_handler() after gc.collect() causes a HardFault.

I don't yet understand enough about how micropython GC works with LVGL to know how this might be fixed.

#2 lv_draw_dispatch_layer (disp=disp@entry=0x20008e00, layer=layer@entry=0x20006720)
at /.../lv_binding_micropython/lvgl/src/draw/lv_draw.c:239
239 t_next = t->next;
(gdb) p *t
$1 = {next = 0x0, type = LV_DRAW_TASK_TYPE_NONE, area = {x1 = 0, y1 = 0, x2 = 0, y2 = 0}, _real_area = {x1 = 0, y1 = 0,
x2 = 0, y2 = 0}, clip_area_original = {x1 = 0, y1 = 0, x2 = 0, y2 = 0}, clip_area = {x1 = 0, y1 = 0, x2 = 0,
y2 = 0}, target_layer = 0x0, draw_unit = 0x0, state = 0, draw_dsc = 0x0, opa = 0 '\000',
preferred_draw_unit_id = 0 '\000', preference_score = 0 '\000'}
(gdb) l
234 lv_draw_task_t * t_prev = NULL;
235 lv_draw_task_t * t = layer->draw_task_head;
236 lv_draw_task_t * t_next;
237 bool remove_task = false;
238 while(t) {
239 t_next = t->next;
240 if(t->state == LV_DRAW_TASK_STATE_FINISHED) {
241 cleanup_task(t, disp);
242 remove_task = true;
243 if(t_prev != NULL)
(gdb) p *layer->draw_task_head
$2 = {next = 0x3b066a63, type = 99, area = {x1 = 1595806640, y1 = -1329389749, x2 = 1437802003, y2 = -977009872},
_real_area = {x1 = -558779194, y1 = -1313520317, x2 = -1236777762, y2 = 1499027906}, clip_area_original = {
x1 = 1111638617, y1 = -565071329, x2 = -1337375533, y2 = 917911316}, clip_area = {x1 = 1111644417, y1 = 105005634,
x2 = 103441233, y2 = -1335598278}, target_layer = 0x81b13214, draw_unit = 0x51590236, state = 956705379,
draw_dsc = 0x14b06463, opa = 50 '2', preferred_draw_unit_id = 177 '\261', preference_score = 128 '\200'}
(gdb) p layer->draw_task_head
$3 = (lv_draw_task_t *) 0x80eec07 <fun_data_asyncio_core_IOQueue_wait_io_event+154>
(gdb) p layer
$4 = (lv_layer_t *) 0x20006720

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Fields

    No fields configured for issues without a type.

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions