Changeset 8849


Ignore:
Timestamp:
Jul 27, 2009, 6:48:21 PM (13 years ago)
Author:
charles
Message:

(trunk gtk) possible fix for #2267

File:
1 edited

Legend:

Unmodified
Added
Removed
  • trunk/gtk/icons.c

    r8627 r8849  
    1919get_static_string( const char *s )
    2020{
    21     static GHashTable *static_strings = NULL;
    22     const char *result;
    23 
    24     if ( s == NULL )
    25         return NULL;
    26 
    27     if ( static_strings == NULL )
    28         static_strings = g_hash_table_new_full (g_str_hash, g_str_equal, g_free, NULL);
    29 
    30     if ( ! g_hash_table_lookup_extended( static_strings, s, (gpointer) &result, NULL )) {
    31         result = g_strdup( s );
    32         g_hash_table_insert( static_strings,
    33                              (gpointer) result,
    34                              GINT_TO_POINTER( 1 ));
    35     }
    36 
    37     return result;
     21    static GStringChunk * static_strings = NULL;
     22
     23     if( s == NULL )
     24         return NULL;
     25
     26     if( static_strings == NULL )
     27         static_strings = g_string_chunk_new( 1024 );
     28
     29    return g_string_chunk_insert_const( static_strings, s );
    3830}
    3931#endif
     
    216208        return pixbuf;
    217209    }
    218        
     210
    219211    pixbuf = _get_icon_pixbuf( icon, icon_cache->icon_size, icon_cache->icon_theme );
    220     g_hash_table_insert( icon_cache->cache, (gpointer) key, g_object_ref( pixbuf ));
     212    if( pixbuf != NULL )
     213        g_hash_table_insert( icon_cache->cache, (gpointer) key, g_object_ref( pixbuf ) );
    221214       
    222215    return pixbuf;
Note: See TracChangeset for help on using the changeset viewer.