summaryrefslogtreecommitdiff
path: root/gtk/gtkflowbox.c
diff options
context:
space:
mode:
authorMatthias Clasen <mclasen@redhat.com>2020-05-13 20:32:30 -0400
committerMatthias Clasen <mclasen@redhat.com>2020-05-13 21:47:11 -0400
commit33011ccdff4a0167de1d1fe415819736cf97875f (patch)
tree1a6cc7cece92c976f2a332c2bbac191825459cfc /gtk/gtkflowbox.c
parent7915e998e2459eee04f0fc52d018183d26c2a4d2 (diff)
downloadgtk+-33011ccdff4a0167de1d1fe415819736cf97875f.tar.gz
flowbox: Avoid a crash in measure()
When the children request a height of zero, the flowbox measure() function was happily dividing by that zero, leading to badness.
Diffstat (limited to 'gtk/gtkflowbox.c')
-rw-r--r--gtk/gtkflowbox.c2
1 files changed, 2 insertions, 0 deletions
diff --git a/gtk/gtkflowbox.c b/gtk/gtkflowbox.c
index 26b78e3fa3..5c022d45cd 100644
--- a/gtk/gtkflowbox.c
+++ b/gtk/gtkflowbox.c
@@ -2075,6 +2075,8 @@ gtk_flow_box_measure (GtkWidget *widget,
goto out_width;
get_max_item_size (box, GTK_ORIENTATION_VERTICAL, &min_item_height, &nat_item_height);
+ if (nat_item_height <= 0)
+ goto out_width;
/* By default flow at the natural item width */
line_length = avail_size / (nat_item_height + priv->row_spacing);