Skip to content
Commit 9d133d8e authored by Florian Müllner's avatar Florian Müllner
Browse files

st: Guard against spec being invalided during shadow creation

If an actor is pending a relaying when get_allocation_box() is called,
the method forces an allocation update. In case of StWidget, this might
then result in a style update and a consecutive invalidation of the
shadow spec - we will then try to create a shadow specified by random
memory, with undefined (though likely fatal) consequences.

Guard against this by taking a temporary reference during the function
call.

https://bugzilla.gnome.org/show_bug.cgi?id=788908
parent a347ed99
  • Developer

    This patch seems to fix the crash (or at least I can't reproduce it anymore), but I still see lots of CRITICAL messages in the console like this one:

    (gnome-shell:10592): St-CRITICAL **: _st_paint_shadow_with_opacity: assertion 'shadow_spec != NULL' failed

    ...which seem caused because the priv->shadow_spec pointer is still being invalidated (made NULL), which makes the following code call _st_paint_shadow_with_opacity() with an invalid value:

    static void
    st_icon_paint (ClutterActor *actor)
    {
      StIconPrivate *priv = ST_ICON (actor)->priv;
    
      st_widget_paint_background (ST_WIDGET (actor));
    
      if (priv->icon_texture)
        {
          if (priv->shadow_pipeline)
            {
              ClutterActorBox allocation;
              float width, height;
    
              clutter_actor_get_allocation_box (priv->icon_texture, &allocation);
              clutter_actor_box_get_size (&allocation, &width, &height);
    
              _st_paint_shadow_with_opacity (priv->shadow_spec,
                                             priv->shadow_pipeline,
                                             &allocation,
                                             clutter_actor_get_paint_opacity (priv->icon_texture));
            }
    
          clutter_actor_paint (priv->icon_texture);
        }
    }
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment