--- a/ui/common/document.c Thu Nov 28 18:04:55 2024 +0100 +++ b/ui/common/document.c Thu Nov 28 18:05:31 2024 +0100 @@ -86,12 +86,13 @@ CxMempool *mp = cxMempoolCreate(256, NULL); const CxAllocator *a = mp->allocator; UiContext *ctx = cxCalloc(a, 1, sizeof(UiContext)); + ctx->mp = mp; ctx->attach_document = uic_context_attach_document; ctx->detach_document2 = uic_context_detach_document2; ctx->allocator = a; ctx->vars = cxHashMapCreate(a, CX_STORE_POINTERS, 16); - void *document = cxCalloc(a, 1, size); + void *document = cxCalloc(a, size, 1); cxMapPut(documents, cx_hash_key(&document, sizeof(void*)), ctx); return document; }