--- a/src/kv_list.c Tue Sep 02 21:12:51 2025 +0200 +++ b/src/kv_list.c Wed Sep 03 22:52:20 2025 +0200 @@ -214,7 +214,19 @@ // check if the outside caller want's us to return or to destroy the element if (targetbuf == NULL) { // destroy the element + // invoke all destructors from both the list and the map aspect + // (usually the user will only use one of the aspects anyway and if not, it's documented) cx_invoke_destructor(&kv_list->list.list_base, node_data); + // note that we cannot use the macro, because it will use the wrong store_pointer information + CxMap *map_aspect = &kv_list->map->map_base.base; + if (map_aspect->collection.simple_destructor) { + map_aspect->collection.simple_destructor( + kv_list->list.list_base.collection.store_pointer ? *(void**)node_data : node_data); + } + if (map_aspect->collection.advanced_destructor) { + map_aspect->collection.advanced_destructor(map_aspect->collection.destructor_data, + kv_list->list.list_base.collection.store_pointer ? *(void**)node_data : node_data); + } } else { // copy the element to the target buffer memcpy(targetbuf, node_data, kv_list->list.list_base.collection.elem_size);