st-texture-cache: Don't cache GIcons which cannot be serialized
For GIcons we use g_icon_to_string() in the key, but the function will return NULL if the icon cannot be serialized. As a result, all non-serializable GIcons of the same size end up with the same cache key - an example for this are contacts with avatars, which currently all end up with the same image. To fix, opt out of caching for GIcons which cannot be serialized. https://bugzilla.gnome.org/show_bug.cgi?id=660585
This commit is contained in:
parent
77485c2a04
commit
e49a595f54
@ -1177,8 +1177,15 @@ load_gicon_with_colors (StTextureCache *cache,
|
|||||||
char *key;
|
char *key;
|
||||||
GtkIconTheme *theme;
|
GtkIconTheme *theme;
|
||||||
GtkIconInfo *info;
|
GtkIconInfo *info;
|
||||||
|
StTextureCachePolicy policy;
|
||||||
|
|
||||||
gicon_string = g_icon_to_string (icon);
|
gicon_string = g_icon_to_string (icon);
|
||||||
|
/* A return value of NULL indicates that the icon can not be serialized,
|
||||||
|
* so don't have a unique identifier for it as a cache key, and thus can't
|
||||||
|
* be cached. If it is cachable, we hardcode a policy of FOREVER here for
|
||||||
|
* now; we should actually blow this away on icon theme changes probably */
|
||||||
|
policy = gicon_string != NULL ? ST_TEXTURE_CACHE_POLICY_FOREVER
|
||||||
|
: ST_TEXTURE_CACHE_POLICY_NONE;
|
||||||
if (colors)
|
if (colors)
|
||||||
{
|
{
|
||||||
/* This raises some doubts about the practice of using string keys */
|
/* This raises some doubts about the practice of using string keys */
|
||||||
@ -1210,9 +1217,7 @@ load_gicon_with_colors (StTextureCache *cache,
|
|||||||
{
|
{
|
||||||
/* Transfer ownership of key */
|
/* Transfer ownership of key */
|
||||||
request->key = key;
|
request->key = key;
|
||||||
/* hardcoded here for now; we should actually blow this away on
|
request->policy = policy;
|
||||||
* icon theme changes probably */
|
|
||||||
request->policy = ST_TEXTURE_CACHE_POLICY_FOREVER;
|
|
||||||
request->icon = g_object_ref (icon);
|
request->icon = g_object_ref (icon);
|
||||||
request->icon_info = info;
|
request->icon_info = info;
|
||||||
request->width = request->height = size;
|
request->width = request->height = size;
|
||||||
|
Loading…
Reference in New Issue
Block a user