diff -r 943fc009bd1c -r 86ed681698aa ui/win32/menu.c --- a/ui/win32/menu.c Wed Jul 15 20:03:33 2026 +0200 +++ b/ui/win32/menu.c Tue Jul 21 16:46:44 2026 +0200 @@ -289,6 +289,7 @@ ls->command_ids = cxArrayListCreate(a, sizeof(uint64_t), 16); ls->index = pos; ls->getvalue = il->getvalue; + ls->getvaluedata = NULL; // TODO ls->callback = il->callback; ls->userdata = il->userdata; ls->addseparator = il->addseparator; @@ -339,12 +340,15 @@ } cxListClear(list->command_ids); // TODO: we could reuse some of the ids - ui_getvaluefunc getvalue = list->getvalue; + ui_getvaluefunc2 getvalue = list->getvalue; + void *getvaluedata = list->getvaluedata; void* elm = ui_list_first(ls); int pos = list->index; + int row = 0; while(elm) { - char *label = (char*) (getvalue ? getvalue(elm, 0) : elm); + UiBool freeResult = FALSE; + char *label = (char*) (getvalue ? getvalue(ls, elm, row, 0, getvaluedata, &freeResult) : elm); if (!label) { label = ""; } @@ -353,7 +357,12 @@ InsertMenu(list->menu, pos++, MF_STRING, id, label); cxListAdd(list->command_ids, &id); + if (freeResult) { + free(label); + } + elm = ui_list_next(ls); + row++; } }