ui/common/context.c

branch
newapi
changeset 350
70305d427f25
parent 343
54f5d7eb1335
--- a/ui/common/context.c	Wed Oct 23 17:16:51 2024 +0200
+++ b/ui/common/context.c	Fri Oct 25 15:37:02 2024 +0200
@@ -209,7 +209,7 @@
 UiVar* uic_create_value_var(UiContext* ctx, void* value) {
     UiVar *var = (UiVar*)ui_malloc(ctx, sizeof(UiVar));
     var->from = NULL;
-    var->from_ctx = NULL;
+    var->from_ctx = ctx;
     var->value = value;
     var->type = UI_VAR_SPECIAL;
     return var;
@@ -563,7 +563,7 @@
 }
 
 void ui_free(UiContext *ctx, void *ptr) {
-    if(ctx) {
+    if(ctx && ptr) {
         cxFree(ctx->allocator, ptr);
     }
 }

mercurial