7 days ago
fix crash in motif textfield functions
ui/motif/text.c | file | annotate | diff | comparison | revisions |
--- a/ui/motif/text.c Sun Apr 06 13:45:18 2025 +0200 +++ b/ui/motif/text.c Sun Apr 06 13:53:33 2025 +0200 @@ -433,7 +433,9 @@ } char* ui_textfield_get(UiString *str) { - str->value.free(str->value.ptr); + if(str->value.free) { + str->value.free(str->value.ptr); + } char *value = XmTextFieldGetString(str->obj); str->value.ptr = value; str->value.free = (ui_freefunc)XtFree; @@ -442,8 +444,10 @@ void ui_textfield_set(UiString *str, const char *value) { XmTextFieldSetString(str->obj, (void*)value); + if(str->value.free) { + str->value.free(str->value.ptr); + } str->value.ptr = NULL; - str->value.free(str->value.ptr); }