mirror of
https://github.com/transmission/transmission
synced 2025-02-11 08:54:55 +00:00
(trunk gtk) possible fix for #2267
This commit is contained in:
parent
7cb873b69e
commit
5e0315892b
1 changed files with 9 additions and 16 deletions
15
gtk/icons.c
15
gtk/icons.c
|
@ -18,23 +18,15 @@
|
||||||
static const char *
|
static const char *
|
||||||
get_static_string( const char *s )
|
get_static_string( const char *s )
|
||||||
{
|
{
|
||||||
static GHashTable *static_strings = NULL;
|
static GStringChunk * static_strings = NULL;
|
||||||
const char *result;
|
|
||||||
|
|
||||||
if( s == NULL )
|
if( s == NULL )
|
||||||
return NULL;
|
return NULL;
|
||||||
|
|
||||||
if( static_strings == NULL )
|
if( static_strings == NULL )
|
||||||
static_strings = g_hash_table_new_full (g_str_hash, g_str_equal, g_free, NULL);
|
static_strings = g_string_chunk_new( 1024 );
|
||||||
|
|
||||||
if ( ! g_hash_table_lookup_extended( static_strings, s, (gpointer) &result, NULL )) {
|
return g_string_chunk_insert_const( static_strings, s );
|
||||||
result = g_strdup( s );
|
|
||||||
g_hash_table_insert( static_strings,
|
|
||||||
(gpointer) result,
|
|
||||||
GINT_TO_POINTER( 1 ));
|
|
||||||
}
|
|
||||||
|
|
||||||
return result;
|
|
||||||
}
|
}
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
|
@ -217,6 +209,7 @@ icon_cache_get_mime_type_icon( IconCache * icon_cache,
|
||||||
}
|
}
|
||||||
|
|
||||||
pixbuf = _get_icon_pixbuf( icon, icon_cache->icon_size, icon_cache->icon_theme );
|
pixbuf = _get_icon_pixbuf( icon, icon_cache->icon_size, icon_cache->icon_theme );
|
||||||
|
if( pixbuf != NULL )
|
||||||
g_hash_table_insert( icon_cache->cache, (gpointer) key, g_object_ref( pixbuf ) );
|
g_hash_table_insert( icon_cache->cache, (gpointer) key, g_object_ref( pixbuf ) );
|
||||||
|
|
||||||
return pixbuf;
|
return pixbuf;
|
||||||
|
|
Loading…
Reference in a new issue