From ed17c74f586196c95c4cc9f061451db005aff3de Mon Sep 17 00:00:00 2001 From: Matthias Clasen Date: Sat, 24 Mar 2012 17:16:47 -0400 Subject: [PATCH] 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 file changed, 3 insertions(+) diff --git a/gtk/gtkgrid.c b/gtk/gtkgrid.c index fdbdf7c147..8a96e82751 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];