shadow: Don't attempt to create a shadow for unallocated actors

Calling clutter_actor_get_allocation_box() can potentially cause a
re-layout, which in _st_create_shadow_pipeline_from_actor() would
mean invalidating the shadow_spec passed as a parameter, which
could crash the shell later on since the value for shadow_spec->blur
passed from _st_create_shadow_pipeline() to blur_pixels() would
not be a valid one.

Thus, whether the ClutterActor has an allocation before calling
clutter_actor_get_allocation_box(), and early return if needed.

https://gitlab.gnome.org/GNOME/gnome-shell/issues/36

Closes: #36
This commit is contained in:
Mario Sanchez Prada 2018-02-09 11:50:32 +00:00
parent cc028dd55a
commit 735ce62e8b

View File

@ -417,6 +417,11 @@ _st_create_shadow_pipeline_from_actor (StShadow *shadow_spec,
ClutterActorBox box;
float width, height;
/* Calling clutter_actor_get_allocation_box() can provoke a re-layout, which
* would invalidate the shadow_spec, so check this and early return if needed. */
if (!clutter_actor_has_allocation(actor))
return NULL;
clutter_actor_get_allocation_box (actor, &box);
clutter_actor_box_get_size (&box, &width, &height);