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



commit f7bd33e4989433c1bbc8af0090a2fdc6f76e30f9
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]