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



commit 217da253691e7f562da01746b9da95e5a710886c
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 1f44fb9..c4e3bed 100644
--- a/clutter/clutter-actor.c
+++ b/clutter/clutter-actor.c
@@ -6617,14 +6617,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]