mirror of
https://github.com/brl/mutter.git
synced 2025-02-09 01:54:10 +00:00
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.
This commit is contained in:
parent
409c3ed8ff
commit
b4d3b52b62
@ -6610,14 +6610,18 @@ clutter_actor_adjust_allocation (ClutterActor *self,
|
|||||||
|
|
||||||
#ifdef CLUTTER_ENABLE_DEBUG
|
#ifdef CLUTTER_ENABLE_DEBUG
|
||||||
/* warn about underallocations */
|
/* 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 "
|
g_warning (G_STRLOC ": The actor '%s' is getting an allocation "
|
||||||
"of %.2f x %.2f from its parent actor '%s', but its "
|
"of %.2f x %.2f from its parent actor '%s', but its "
|
||||||
"requested minimum size is of %.2f x %.2f",
|
"requested minimum size is of %.2f x %.2f",
|
||||||
_clutter_actor_get_debug_name (self),
|
_clutter_actor_get_debug_name (self),
|
||||||
alloc_width, alloc_height,
|
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);
|
min_width, min_height);
|
||||||
}
|
}
|
||||||
#endif
|
#endif
|
||||||
|
Loading…
x
Reference in New Issue
Block a user