ui/common/document.c

branch
newapi
changeset 232
e2b33055113f
parent 187
24ce2c326d85
--- a/ui/common/document.c	Sun Jan 28 10:06:54 2024 +0100
+++ b/ui/common/document.c	Sun Jan 28 11:42:42 2024 +0100
@@ -38,7 +38,9 @@
 static CxMap *documents;
 
 void uic_docmgr_init() {
-    documents = cxHashMapCreate(cxDefaultAllocator, CX_STORE_POINTERS, 32);
+    if (!documents) {
+        documents = cxHashMapCreate(cxDefaultAllocator, CX_STORE_POINTERS, 32);
+    }
 }
 
 void ui_set_document(UiObject *obj, void *document) {
@@ -80,7 +82,7 @@
 }
 
 void* ui_document_new(size_t size) {
-    CxMempool *mp = cxBasicMempoolCreate(256);
+    CxMempool *mp = cxMempoolCreate(256, NULL);
     const CxAllocator *a = mp->allocator;
     UiContext *ctx = cxCalloc(a, 1, sizeof(UiContext));
     ctx->attach_document = uic_context_attach_document;

mercurial