[gtk: 36/40] IconHelper: Only preload icons once
- From: Alexander Larsson <alexl src gnome org>
- To: commits-list gnome org
- Cc:
- Subject: [gtk: 36/40] IconHelper: Only preload icons once
- Date: Thu, 30 Jan 2020 17:34:10 +0000 (UTC)
commit 498ab6ac6cd8681baa4f5bee0dd8a86e4191e9b7
Author: Alexander Larsson <alexl redhat com>
Date: Thu Jan 30 15:17:59 2020 +0100
IconHelper: Only preload icons once
This limits the amount of preloading we to, which can for instance
avoid trashing if the icon cache is full, and in general do less work
when its likely to be wasted such as when e.g. background-color for an
icon helper changes.
gtk/gtkiconhelper.c | 7 +++++++
1 file changed, 7 insertions(+)
---
diff --git a/gtk/gtkiconhelper.c b/gtk/gtkiconhelper.c
index e266887c56..a940b9f657 100644
--- a/gtk/gtkiconhelper.c
+++ b/gtk/gtkiconhelper.c
@@ -48,6 +48,7 @@ struct _GtkIconHelper
guint use_fallback : 1;
guint force_scale_pixbuf : 1;
guint texture_is_symbolic : 1;
+ guint preloaded : 1;
GtkWidget *owner;
GtkCssNode *node;
@@ -184,6 +185,12 @@ _gtk_icon_helper_preload (GtkIconHelper *self)
GIcon *gicon = NULL;
GIcon *free_gicon = NULL;
+ /* Avoid constantly preloading as it may cause issues if we're trashing the icon cache */
+ if (self->preloaded)
+ return;
+
+ self->preloaded = TRUE;
+
switch (gtk_image_definition_get_storage_type (self->def))
{
case GTK_IMAGE_ICON_NAME:
[
Date Prev][
Date Next] [
Thread Prev][
Thread Next]
[
Thread Index]
[
Date Index]
[
Author Index]