[gtk+] grid: avoid a floating point exception



commit ed17c74f586196c95c4cc9f061451db005aff3de
Author: Matthias Clasen <mclasen redhat com>
Date:   Sat Mar 24 17:16:47 2012 -0400

    grid: avoid a floating point exception
    
    When a homogeneous grid has no visible children, we were
    accidentally doing a division by zero. Instead, just bail
    out early in this case, there is nothing to allocate anyway.
    
    https://bugzilla.gnome.org/show_bug.cgi?id=672763

 gtk/gtkgrid.c |    3 +++
 1 files changed, 3 insertions(+), 0 deletions(-)
---
diff --git a/gtk/gtkgrid.c b/gtk/gtkgrid.c
index fdbdf7c..8a96e82 100644
--- a/gtk/gtkgrid.c
+++ b/gtk/gtkgrid.c
@@ -1020,6 +1020,9 @@ gtk_grid_request_allocate (GtkGridRequest *request,
 
   gtk_grid_request_compute_expand (request, orientation, &nonempty, &expand);
 
+  if (nonempty == 0)
+    return;
+
   linedata = &priv->linedata[orientation];
   lines = &request->lines[orientation];
 



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