# HG changeset patch # User Olaf Wintermann # Date 1736804864 -3600 # Node ID 0a52c26bba1ab1ea4ab04283e29c9bb06478151c # Parent 3379c8a5b6bb4d4885abb81960f7275f351aafb3 fix columnsize field not copied in ui_model_copy diff -r 3379c8a5b6bb -r 0a52c26bba1a application/main.c --- a/application/main.c Mon Jan 13 22:44:01 2025 +0100 +++ b/application/main.c Mon Jan 13 22:47:44 2025 +0100 @@ -414,7 +414,7 @@ ui_tab(obj, "Tab 1") { UiModel *model = ui_model(obj->ctx, UI_STRING, "col1", UI_INTEGER, "col2", UI_ICON, "col3", UI_ICON_TEXT, "col4", UI_INTEGER, "col5", -1); model->getvalue = table_getvalue; - ui_listview(obj, .model = model, .list = doc->list2, .colspan = 2, .fill = UI_ON, .contextmenu = menubuilder, .multiselection = TRUE, + ui_table(obj, .model = model, .list = doc->list2, .colspan = 2, .fill = UI_ON, .contextmenu = menubuilder, .multiselection = TRUE, .onactivate = action_table_activate, .onactivatedata = "activate", .onselection = action_table_activate, .onselectiondata = "selection"); } diff -r 3379c8a5b6bb -r 0a52c26bba1a ui/common/types.c --- a/ui/common/types.c Mon Jan 13 22:44:01 2025 +0100 +++ b/ui/common/types.c Mon Jan 13 22:47:44 2025 +0100 @@ -231,6 +231,8 @@ for (int i = 0; i < model->columns; i++) { newmodel->titles[i] = model->titles[i] ? cx_strdup_a(a, cx_str(model->titles[i])).ptr : NULL; } + newmodel->columnsize = cxCalloc(a, model->columns, sizeof(int)); + memcpy(newmodel->columnsize, model->columnsize, model->columns*sizeof(int)); return newmodel; } @@ -239,6 +241,7 @@ const CxAllocator* a = ctx ? ctx->allocator : cxDefaultAllocator; cxFree(a, mi->types); cxFree(a, mi->titles); + cxFree(a, mi->columnsize); cxFree(a, mi); }