flow-layout: Check for all positive values
authorMike Ruprecht <mike.ruprecht@collabora.co.uk>
Tue, 22 May 2012 13:25:19 +0000 (14:25 +0100)
committerEmmanuele Bassi <ebassi@linux.intel.com>
Tue, 22 May 2012 13:25:19 +0000 (14:25 +0100)
When creating a FlowLayout container, setting a specific size on it, and
adding a child to it, as per the attached testcase, it crashes. The line
on the backtrace doesn't really make sense, but from looking over it, it
appears that it's probably because priv->line_natural is NULL. The
attached patch makes it so in this case, priv->line_natural is
allocated.

https://bugzilla.gnome.org/show_bug.cgi?id=676068

Signed-off-by: Emmanuele Bassi <ebassi@linux.intel.com>
clutter/clutter-flow-layout.c

index 94df4db..97524b2 100644 (file)
@@ -580,8 +580,8 @@ clutter_flow_layout_allocate (ClutterLayoutManager   *manager,
    * available size in case the FlowLayout wasn't given the exact
    * size it requested
    */
-  if ((priv->req_width > 0 && avail_width != priv->req_width) ||
-      (priv->req_height > 0 && avail_height != priv->req_height))
+  if ((priv->req_width >= 0 && avail_width != priv->req_width) ||
+      (priv->req_height >= 0 && avail_height != priv->req_height))
     {
       clutter_flow_layout_get_preferred_width (manager, container,
                                                avail_height,