Description
When creating a table from an existing one an access violation occurs at refresh.
It looks to me that the cause is ext->cell_data
is not being copied from copy_ext->cell_data
which would involve among other things allocating memory for the contents.and copying it to the allocated memory from the respective locations…
What MCU/Processor/Board and compiler are you using?
Simulator
What do you experience?
Exception thrown at 0x00007FF6F6D3DE72 in visual_studio_2017_sdl_x64.exe: 0xC0000005: Access violation reading location 0x0000000000000000.
What do you expect?
Just letting you know
Code to reproduce
From lv_ex_table_1
, add last two lines.
void lv_ex_table_1(void)
{
/*Create a normal cell style*/
static lv_style_t style_cell1;
lv_style_copy(&style_cell1, &lv_style_plain);
style_cell1.body.border.width = 1;
style_cell1.body.border.color = LV_COLOR_BLACK;
/*Crealte a header cell style*/
static lv_style_t style_cell2;
lv_style_copy(&style_cell2, &lv_style_plain);
style_cell2.body.border.width = 1;
style_cell2.body.border.color = LV_COLOR_BLACK;
style_cell2.body.main_color = LV_COLOR_SILVER;
style_cell2.body.grad_color = LV_COLOR_SILVER;
lv_obj_t * table = lv_table_create(lv_scr_act(), NULL);
lv_table_set_style(table, LV_TABLE_STYLE_CELL1, &style_cell1);
lv_table_set_style(table, LV_TABLE_STYLE_CELL2, &style_cell2);
lv_table_set_style(table, LV_TABLE_STYLE_BG, &lv_style_transp_tight);
lv_table_set_col_cnt(table, 2);
lv_table_set_row_cnt(table, 4);
lv_obj_align(table, NULL, LV_ALIGN_CENTER, 0, 0);
/*Make the cells of the first row center aligned */
lv_table_set_cell_align(table, 0, 0, LV_LABEL_ALIGN_CENTER);
lv_table_set_cell_align(table, 0, 1, LV_LABEL_ALIGN_CENTER);
/*Make the cells of the first row TYPE = 2 (use `style_cell2`) */
lv_table_set_cell_type(table, 0, 0, 2);
lv_table_set_cell_type(table, 0, 1, 2);
/*Fill the first column*/
lv_table_set_cell_value(table, 0, 0, "Name");
lv_table_set_cell_value(table, 1, 0, "Apple");
lv_table_set_cell_value(table, 2, 0, "Banana");
lv_table_set_cell_value(table, 3, 0, "Citron");
/*Fill the second column*/
lv_table_set_cell_value(table, 0, 1, "Price");
lv_table_set_cell_value(table, 1, 1, "$7");
lv_table_set_cell_value(table, 2, 1, "$4");
lv_table_set_cell_value(table, 3, 1, "$6");
lv_obj_t* table2 = lv_table_create(lv_scr_act(), table);
lv_obj_align(table2, table, LV_ALIGN_OUT_BOTTOM_MID, 0, LV_DPI/4);
}