[gtk/matthiasc/for-master: 2/4] flowbox: Avoid a crash in measure()



commit 33011ccdff4a0167de1d1fe415819736cf97875f
Author: Matthias Clasen <mclasen redhat com>
Date:   Wed May 13 20:32:30 2020 -0400

    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.

 gtk/gtkflowbox.c | 2 ++
 1 file changed, 2 insertions(+)
---
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);


[Date Prev][Date Next]   [Thread Prev][Thread Next]   [Thread Index] [Date Index] [Author Index]