summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorLogan Rathbone <poprocks@gmail.com>2023-02-02 22:32:28 -0500
committerLogan Rathbone <poprocks@gmail.com>2023-02-02 22:32:28 -0500
commit8dae0206b4c37b107bf4bc639e2d3e8c59d129d8 (patch)
tree729e883460c98fb3d7ef727c6ee31df5df71bb6a
parent6b77fe54625101cb9769d3b7e4324438a1f65a66 (diff)
downloadzenity-8dae0206b4c37b107bf4bc639e2d3e8c59d129d8.tar.gz
tree: Fix radiolist infinite loop
Only ever define the checkbutton group once. Redefining the checkbutton group as the O.G. one can lead to U.B.
-rw-r--r--src/zenity-tree-column-view.c32
1 files changed, 17 insertions, 15 deletions
diff --git a/src/zenity-tree-column-view.c b/src/zenity-tree-column-view.c
index 7902a9a..54c6768 100644
--- a/src/zenity-tree-column-view.c
+++ b/src/zenity-tree-column-view.c
@@ -234,7 +234,7 @@ struct _ZenityTreeColumnView
ZenityTreeListType list_type;
GListModel *model;
GtkStringFilter *filter;
- GtkCheckButton *checkbutton_group;
+ GtkCheckButton *initial_checkbutton_group;
};
G_DEFINE_TYPE (ZenityTreeColumnView, zenity_tree_column_view, GTK_TYPE_WIDGET)
@@ -515,22 +515,24 @@ factory_bind_cb (ZenityTreeColumnView *self,
if (g_object_get_data (G_OBJECT(item_child), "initialized"))
initialized = TRUE;
- /* Radio-button-ize our check buttons if radio list requested
- */
- if (self->list_type == ZENITY_TREE_LIST_RADIO)
- {
- if (!self->checkbutton_group)
- self->checkbutton_group = GTK_CHECK_BUTTON(item_child);
-
- /* Annoying - if you try to add checkbtn to its own group, gtk
- * spews errors instead of just returning silently.
- */
- if (GTK_CHECK_BUTTON(item_child) != self->checkbutton_group)
- gtk_check_button_set_group (GTK_CHECK_BUTTON(item_child), self->checkbutton_group);
- }
-
if (! initialized)
{
+ /* Radio-button-ize our check buttons if radio list requested
+ */
+ if (self->list_type == ZENITY_TREE_LIST_RADIO)
+ {
+ if (!self->initial_checkbutton_group)
+ {
+ self->initial_checkbutton_group = GTK_CHECK_BUTTON(item_child);
+ }
+
+ /* Annoying - if you try to add checkbtn to its own group, gtk
+ * spews errors instead of just returning silently.
+ */
+ if (GTK_CHECK_BUTTON(item_child) != self->initial_checkbutton_group)
+ gtk_check_button_set_group (GTK_CHECK_BUTTON(item_child), self->initial_checkbutton_group);
+ }
+
if (g_ascii_strcasecmp (item_text, "true") == 0)
checked = TRUE;