Cannot make chart work in flex layout

Hi all. I have the code at the bottomrunning and producing this:

I am getting my feet wet in lvgl and am trying things just to try them out. I now want a chart in a flex column, but If I enable line 34 the application hangs and nothing gets rendered. Do you have any ideas why lv_chart_set_next_value(chart, ser1, (int32_t)lv_rand(10, 50)); would cause an infinite loop ( or recursion ).

I am building on Windows with mingw_64.

Any help is greatly appreciated.

Morten


Code:

#include <Windows.h>
#include "lvgl/lvgl.h"
#include "lvgl/examples/lv_examples.h"
#include "lvgl/demos/lv_demos.h"
#include <stdio.h>

#include <string>

static uint8_t cnt = 0;


lv_obj_t* createButton(int i , lv_obj_t* PARENT)
{
    i+=64;
    char text[30];
    sprintf(text, "Button '%c'", i);
    lv_obj_t * btn = lv_button_create( PARENT );
    lv_obj_t * bllabel = lv_label_create(btn);
    lv_label_set_text(bllabel, text);
    lv_obj_center(bllabel);
    return btn;
}

lv_obj_t* createChart(lv_obj_t* parent)
{
    lv_obj_t * chart;
    chart = lv_chart_create(parent);
    lv_chart_set_type(chart, LV_CHART_TYPE_LINE);

    lv_chart_set_point_count(chart, 10);
    lv_chart_series_t * ser1 = lv_chart_add_series(chart, lv_palette_main(LV_PALETTE_GREEN), LV_CHART_AXIS_PRIMARY_Y);
    uint32_t i;
    for(i = 0; i < 10; i++) {
        //lv_chart_set_next_value(chart, ser1, (int32_t)lv_rand(10, 50)); // <<--- REMOVE AND IT WORKS
    }
    lv_chart_refresh(chart);
    return chart;
}


int main()
{
    lv_init();

    int32_t zoom_level = 100;
    bool allow_dpi_override = false;
    bool simulator_mode = false;
    lv_display_t* display = lv_windows_create_display(
        L"LVGL Display Window",
        800, 480,
        zoom_level, allow_dpi_override, simulator_mode);

    if (!display) return -1;

    lv_lock();

    lv_indev_t* pointer_device = lv_windows_acquire_pointer_indev(display);
    if (!pointer_device) return -1;

    lv_indev_t* keypad_device = lv_windows_acquire_keypad_indev(display);
    if (!keypad_device) return -1;

    lv_indev_t* encoder_device = lv_windows_acquire_encoder_indev(display);
    if (!encoder_device)  return -1;

    const int rows = 4;
    const int cols = 4;


    lv_obj_t * row = lv_obj_create(lv_screen_active());
    lv_obj_set_size(row, LV_PCT(100), LV_PCT(100));
    lv_obj_set_pos(row, 0, 0);  // ensure it starts at top-left
    lv_obj_set_flex_flow(row, LV_FLEX_FLOW_ROW);

    int buttonIndex = 1;


    for ( int col = 0; col < cols; col++)
    {

        lv_obj_t * column = lv_obj_create(row);
        lv_obj_set_flex_flow(column, LV_FLEX_FLOW_COLUMN);
        lv_obj_set_flex_grow(column, 1);
        lv_obj_set_height(column, LV_PCT(100));
        lv_obj_set_scrollbar_mode(column, LV_SCROLLBAR_MODE_OFF);

        for( int row = 0 ; row < rows; row++)
        {
            lv_obj_t *button;
            button = createButton(col * rows + row + 1, column );
            lv_obj_set_width(button, LV_PCT(100));
            buttonIndex++;
        }
        lv_obj_t * textarea = lv_textarea_create(column);
        lv_obj_set_width(textarea, LV_PCT(100));
        lv_textarea_set_one_line(textarea, true);

        lv_obj_t * chart = createChart(column);
        lv_obj_set_width(chart, LV_PCT(100));
        lv_obj_set_flex_grow(chart, 1);



    }
   lv_unlock();

    while ( cnt < 10)
    {
        uint32_t time_till_next = lv_timer_handler();
        if(time_till_next == LV_NO_TIMER_READY) time_till_next = LV_DEF_REFR_PERIOD;
        lv_sleep_ms(time_till_next);
    }

    lv_obj_delete(row);

    return 0;
}

Tried to run it in simulator (LVGL V9.3) and it seems to work even with that line commented.

Check the console logs output, if there is any assertion that is being triggered, or go in Debug in step mode at that point to find out what may be happening.