Sun, 31 Mar 2024 09:58:07 +0200
fix double free on radiobutton group destroy
ui/gtk/button.c | file | annotate | diff | comparison | revisions |
--- a/ui/gtk/button.c Sun Mar 31 09:50:49 2024 +0200 +++ b/ui/gtk/button.c Sun Mar 31 09:58:07 2024 +0200 @@ -197,9 +197,13 @@ var = uic_create_var(obj->ctx, args.varname, UI_VAR_INTEGER); } + UiBool first = FALSE; if(var) { rgroup = var->value; rg = rgroup->obj; + if(!rg) { + first = TRUE; + } } GtkWidget *rbutton = gtk_radio_button_new_with_label(rg, args.label ? args.label : ""); @@ -224,11 +228,13 @@ "clicked", G_CALLBACK(ui_radio_obs), event); - g_signal_connect( + if(first) { + g_signal_connect( rbutton, "destroy", G_CALLBACK(ui_destroy_vardata), event); + } } UiContainer *ct = uic_get_current_container(obj);