diff options
author | Matthias Clasen <mclasen@redhat.com> | 2005-08-22 16:38:46 +0000 |
---|---|---|
committer | Matthias Clasen <matthiasc@src.gnome.org> | 2005-08-22 16:38:46 +0000 |
commit | 97ec1cdf4f8d16906f43ef02c11ac13b96d22ad2 (patch) | |
tree | 3e38b4293c0f3fe5ef231e8c054689cf2f947b5c /gtk/gtkiconcache.c | |
parent | e337f0cf190deea7be5ef541320b1deb2f417e35 (diff) | |
download | gtk+-97ec1cdf4f8d16906f43ef02c11ac13b96d22ad2.tar.gz |
Add a note regarding icon theme changes.
2005-08-22 Matthias Clasen <mclasen@redhat.com>
* gtk/gtkicontheme.c (gtk_icon_theme_load_icon): Add a note
regarding icon theme changes.
* gtk/gtkiconcache.c (_gtk_icon_cache_get_icon): When returning
pixbufs which are backed by the mmapped memory of an icon cache,
increase the refcount of the icon cache, so that the memory is not
munmapped away underneath the pixbuf upon icon theme changes.
(#314170, Kjartan Maraas)
Diffstat (limited to 'gtk/gtkiconcache.c')
-rw-r--r-- | gtk/gtkiconcache.c | 18 |
1 files changed, 17 insertions, 1 deletions
diff --git a/gtk/gtkiconcache.c b/gtk/gtkiconcache.c index 8faca64a64..2af6958de7 100644 --- a/gtk/gtkiconcache.c +++ b/gtk/gtkiconcache.c @@ -326,7 +326,16 @@ _gtk_icon_cache_has_icon (GtkIconCache *cache, return FALSE; } - + +static void +pixbuf_destroy_cb (guchar *pixels, + gpointer data) +{ + GtkIconCache *cache = data; + + _gtk_icon_cache_unref (cache); +} + GdkPixbuf * _gtk_icon_cache_get_icon (GtkIconCache *cache, const gchar *icon_name, @@ -371,6 +380,11 @@ _gtk_icon_cache_get_icon (GtkIconCache *cache, pixbuf = gdk_pixbuf_from_pixdata (&pixdata, FALSE, &error); + pixbuf = gdk_pixbuf_new_from_data (pixdata.pixel_data, GDK_COLORSPACE_RGB, + (pixdata.pixdata_type & GDK_PIXDATA_COLOR_TYPE_MASK) == GDK_PIXDATA_COLOR_TYPE_RGBA, + 8, pixdata.width, pixdata.height, pixdata.rowstride, + (GdkPixbufDestroyNotify)pixbuf_destroy_cb, + cache); if (!pixbuf) { GTK_NOTE (ICONTHEME, @@ -380,6 +394,8 @@ _gtk_icon_cache_get_icon (GtkIconCache *cache, return NULL; } + _gtk_icon_cache_ref (cache); + return pixbuf; } |