st-icon: Fix potential crash involving shadows

If the icon is painted before the new shadow is around, a stale
shadow material will be painted with a NULL shadow spec, resulting
in a crash.

https://bugzilla.gnome.org/show_bug.cgi?id=679776
This commit is contained in:
Jasper St. Pierre 2012-07-11 20:26:11 -04:00
parent 168e0b5a42
commit bdb3410d9d

View File

@ -302,6 +302,13 @@ st_icon_style_changed (StWidget *widget)
st_shadow_unref (priv->shadow_spec); st_shadow_unref (priv->shadow_spec);
priv->shadow_spec = NULL; priv->shadow_spec = NULL;
} }
if (priv->shadow_material)
{
cogl_handle_unref (priv->shadow_material);
priv->shadow_material = COGL_INVALID_HANDLE;
}
priv->shadow_spec = st_theme_node_get_shadow (theme_node, "icon-shadow"); priv->shadow_spec = st_theme_node_get_shadow (theme_node, "icon-shadow");
if (priv->shadow_spec && priv->shadow_spec->inset) if (priv->shadow_spec && priv->shadow_spec->inset)