diff options
author | Adam Williamson <awilliam@redhat.com> | 2023-04-20 13:42:29 -0700 |
---|---|---|
committer | Adam Williamson <awilliam@redhat.com> | 2023-04-20 13:42:52 -0700 |
commit | 51a86b6ffa86f56c8e101a8b7c1aacc2e88beeda (patch) | |
tree | 176164da69f70e6d408958bdf19e9d268341b62b /src/zenity-tree-column-view.c | |
parent | 7998cc581046aeab3f7c952656aec8accaef76e2 (diff) | |
download | zenity-51a86b6ffa86f56c8e101a8b7c1aacc2e88beeda.tar.gz |
tree-column-view: don't steal children
When mousing over a dialog that uses this kind of view (e.g.
one created with the test command in
https://gitlab.gnome.org/GNOME/zenity/-/issues/54#note_1726876 ),
I see a lot of these errors on the console:
gtk_list_item_set_child: assertion 'child == NULL || gtk_widget_get_parent (child) == NULL' failed
I think we can hit this callback more than once, and doing so
means we try to set the list item's child again; Gtk doesn't like
that, because we're effectively trying to set the parent of an
item that already has one (it doesn't check if we're just trying
to set the *same* parent, it just complains any time you try to
set something as the child that already has a parent).
Signed-off-by: Adam Williamson <awilliam@redhat.com>
Diffstat (limited to 'src/zenity-tree-column-view.c')
-rw-r--r-- | src/zenity-tree-column-view.c | 3 |
1 files changed, 2 insertions, 1 deletions
diff --git a/src/zenity-tree-column-view.c b/src/zenity-tree-column-view.c index 9b4b5a6..5117f95 100644 --- a/src/zenity-tree-column-view.c +++ b/src/zenity-tree-column-view.c @@ -555,7 +555,8 @@ factory_bind_cb (ZenityTreeColumnView *self, item = zenity_tree_row_get_item (row, col_index); item_child = zenity_tree_item_get_child (item); item_text = zenity_tree_item_get_text (item); - gtk_list_item_set_child (list_item, item_child); + if (!gtk_widget_get_parent (item_child)) + gtk_list_item_set_child (list_item, item_child); gtk_widget_set_halign (item_child, GTK_ALIGN_START); |