diff options
author | Benjamin Otte <otte@redhat.com> | 2016-11-15 22:39:26 +0100 |
---|---|---|
committer | Benjamin Otte <otte@redhat.com> | 2016-11-15 22:39:26 +0100 |
commit | f728f3338214024471a52b188a2affe0cf7a2f04 (patch) | |
tree | 38531a9c4bfc9e19a6b83c301f0330d742bef845 /gtk/gtkcontainer.c | |
parent | 2e9ff11c85eea672b573d60173e0a7193a8471d0 (diff) | |
download | gtk+-f728f3338214024471a52b188a2affe0cf7a2f04.tar.gz |
container: ensure we only append a single node
The snapshot vfuncs must only append at most a single node,
otherwise things are going to break if the widget is the root node.
Unfortunately there is no code that can check this in a generic fashion,
so we'll have to debug this on a case-by-case basis.
Diffstat (limited to 'gtk/gtkcontainer.c')
-rw-r--r-- | gtk/gtkcontainer.c | 13 |
1 files changed, 12 insertions, 1 deletions
diff --git a/gtk/gtkcontainer.c b/gtk/gtkcontainer.c index 629eda1865..767cc5ae31 100644 --- a/gtk/gtkcontainer.c +++ b/gtk/gtkcontainer.c @@ -3095,10 +3095,21 @@ gtk_container_snapshot (GtkWidget *widget, GtkSnapshot *snapshot) { GtkContainer *container = GTK_CONTAINER (widget); - + GtkAllocation allocation, clip; + graphene_rect_t bounds; + + gtk_widget_get_clip (widget, &clip); + gtk_widget_get_allocation (widget, &allocation); + graphene_rect_init (&bounds, + clip.x - allocation.x, clip.y - allocation.y, + clip.width, clip.height); + gtk_snapshot_push (snapshot, &bounds, "Children<%s>", G_OBJECT_TYPE_NAME (container)); + gtk_container_forall (container, gtk_container_snapshot_forall, snapshot); + + gtk_snapshot_pop (snapshot); } static void |