[clutter/wip/apocalypses/apocalypse-1: 14/46] actor: Update the underallocations check



commit 33607d9e7c5ba4cd207b8bea29f9650caedeeb82
Author: Emmanuele Bassi <ebassi linux intel com>
Date:   Thu Nov 24 14:11:00 2011 +0000

    actor: Update the underallocations check
    
    Add a failsafe against a NULL parent, to avoid a segfault when calling
    clutter_actor_allocate() on the Stage.
    
    We also need to deal with floating point values: straight comparison is
    not going to cut it.

 clutter/clutter-actor.c |    8 ++++++--
 1 files changed, 6 insertions(+), 2 deletions(-)
---
diff --git a/clutter/clutter-actor.c b/clutter/clutter-actor.c
index e36ae5f..9460975 100644
--- a/clutter/clutter-actor.c
+++ b/clutter/clutter-actor.c
@@ -6574,14 +6574,18 @@ clutter_actor_adjust_allocation (ClutterActor    *self,
 
 #ifdef CLUTTER_ENABLE_DEBUG
   /* warn about underallocations */
-  if ((min_width > alloc_width) || (min_height > alloc_height))
+  if (floorf (min_width - alloc_width) > 0 ||
+      floorf (min_height - alloc_height) > 0)
     {
+      ClutterActor *parent = clutter_actor_get_parent (self);
+
       g_warning (G_STRLOC ": The actor '%s' is getting an allocation "
                  "of %.2f x %.2f from its parent actor '%s', but its "
                  "requested minimum size is of %.2f x %.2f",
                  _clutter_actor_get_debug_name (self),
                  alloc_width, alloc_height,
-                 _clutter_actor_get_debug_name (priv->parent_actor),
+                 parent != NULL ? _clutter_actor_get_debug_name (parent)
+                                : "top-level",
                  min_width, min_height);
     }
 #endif



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