Compare commits

...

2 Commits

Author SHA1 Message Date
Mario Sanchez Prada
735ce62e8b 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
2018-02-09 12:22:58 +00:00
Mario Sanchez Prada
cc028dd55a st-icon: Null-check for shadow_spec before trying to paint a shadow
The value of priv->shadow_spec can be NULL at the time an icon is
going to be paint (e.g. because of a change in style), so we need
to check it's a valid one before using it in st_icon_paint(), as
it's already being done in other parts of the code.

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

Closes: #36
2018-02-09 12:22:13 +00:00
2 changed files with 6 additions and 1 deletions

View File

@ -164,7 +164,7 @@ st_icon_paint (ClutterActor *actor)
if (priv->icon_texture) if (priv->icon_texture)
{ {
if (priv->shadow_pipeline) if (priv->shadow_spec && priv->shadow_pipeline)
{ {
ClutterActorBox allocation; ClutterActorBox allocation;
float width, height; float width, height;

View File

@ -417,6 +417,11 @@ _st_create_shadow_pipeline_from_actor (StShadow *shadow_spec,
ClutterActorBox box; ClutterActorBox box;
float width, height; 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_get_allocation_box (actor, &box);
clutter_actor_box_get_size (&box, &width, &height); clutter_actor_box_get_size (&box, &width, &height);