Thu, 28 Nov 2024 18:04:55 +0100
fix textarea crash when no value is specified (GTK)
ui/gtk/text.c | file | annotate | diff | comparison | revisions |
--- a/ui/gtk/text.c Wed Nov 27 18:54:00 2024 +0100 +++ b/ui/gtk/text.c Thu Nov 28 18:04:55 2024 +0100 @@ -112,8 +112,8 @@ current->container->add(current->container, scroll_area, TRUE); // bind value - UiText *value = var->value; - if(value) { + if(var) { + UiText *value = var->value; GtkTextBuffer *buf = gtk_text_view_get_buffer(GTK_TEXT_VIEW(text_area)); if(value->value.ptr) { @@ -165,7 +165,9 @@ } void ui_textarea_destroy(GtkWidget *object, UiTextArea *textarea) { - ui_destroy_boundvar(textarea->ctx, textarea->var); + if(textarea->var) { + ui_destroy_boundvar(textarea->ctx, textarea->var); + } free(textarea); }