ui/common/types.c

changeset 1142
e2a6707aa1e0
parent 1115
65870e2dbc1b
child 1168
2f9d8af6a499
--- a/ui/common/types.c	Sun May 24 20:44:08 2026 +0200
+++ b/ui/common/types.c	Tue May 26 21:05:47 2026 +0200
@@ -776,6 +776,14 @@
 }
 
 void uic_text_unbind(UiText *t) {
+    t->obj = NULL;
+    if(t->data1 && t->datatype == UI_TEXT_TYPE_BUFFER) {
+        // the binding functions all work with t->data1, not t->obj
+        // and we don't want to NULL them, because they will be still
+        // functional even without a widget binding
+        return;
+    }
+    
     t->set = NULL;
     t->get = NULL;
     t->getsubstr = NULL;
@@ -787,7 +795,6 @@
     t->setselection = NULL;
     t->length = NULL;
     t->remove = NULL;
-    t->obj = NULL;
 }
 
 void uic_range_unbind(UiRange *r) {

mercurial