# HG changeset patch
# User Olaf Wintermann <olaf.wintermann@gmail.com>
# Date 1732632837 -3600
# Node ID 3099bf907e21128b78a3ec434b9edd373e3a535c
# Parent  df62b7205bd376f452154011b00c28c236f31bf8
fix missing terminator in uic_copy_groups

diff -r df62b7205bd3 -r 3099bf907e21 ui/common/menu.c
--- a/ui/common/menu.c	Tue Nov 26 10:40:03 2024 +0100
+++ b/ui/common/menu.c	Tue Nov 26 15:53:57 2024 +0100
@@ -82,8 +82,9 @@
     for (n = 0; groups[n] > -1; n++) { }
 
     if (ngroups > 0) {
-        int* newarray = calloc(n, sizeof(int));
+        int* newarray = calloc(n+1, sizeof(int));
         memcpy(newarray, groups, n * sizeof(int));
+        newarray[n] = -1;
         *ngroups = n;
         return newarray;
     }
diff -r df62b7205bd3 -r 3099bf907e21 ui/gtk/headerbar.c
--- a/ui/gtk/headerbar.c	Tue Nov 26 10:40:03 2024 +0100
+++ b/ui/gtk/headerbar.c	Tue Nov 26 15:53:57 2024 +0100
@@ -115,6 +115,7 @@
         enum UiToolbarPos pos)
 {
     GtkWidget *button = ui_create_button(obj, item->args.label, item->args.icon, item->args.onclick, item->args.onclickdata, 0, FALSE);
+    ui_set_widget_groups(obj->ctx, button, item->args.groups);
     WIDGET_ADD_CSS_CLASS(button, "flat");
     headerbar_add(headerbar, box, button, pos);
 }
@@ -127,6 +128,7 @@
         enum UiToolbarPos pos)
 {
     GtkWidget *button = gtk_toggle_button_new();
+    ui_set_widget_groups(obj->ctx, button, item->args.groups);
     WIDGET_ADD_CSS_CLASS(button, "flat");
     ui_setup_togglebutton(obj, button, item->args.label, item->args.icon, item->args.varname, NULL, item->args.onchange, item->args.onchangedata, 0);
     headerbar_add(headerbar, box, button, pos);