rpms/gnome-desktop/devel gnome-desktop-2.19.90-gnome-bg.patch, 1.3, 1.4 gnome-desktop.spec, 1.93, 1.94
Soren Sandmann Pedersen (ssp)
fedora-extras-commits at redhat.com
Wed Aug 29 20:46:42 UTC 2007
Author: ssp
Update of /cvs/pkgs/rpms/gnome-desktop/devel
In directory cvs-int.fedora.redhat.com:/tmp/cvs-serv3149
Modified Files:
gnome-desktop-2.19.90-gnome-bg.patch gnome-desktop.spec
Log Message:
Fix unbounded caching
gnome-desktop-2.19.90-gnome-bg.patch:
Index: gnome-desktop-2.19.90-gnome-bg.patch
===================================================================
RCS file: /cvs/pkgs/rpms/gnome-desktop/devel/gnome-desktop-2.19.90-gnome-bg.patch,v
retrieving revision 1.3
retrieving revision 1.4
diff -u -r1.3 -r1.4
--- gnome-desktop-2.19.90-gnome-bg.patch 28 Aug 2007 18:09:51 -0000 1.3
+++ gnome-desktop-2.19.90-gnome-bg.patch 29 Aug 2007 20:46:39 -0000 1.4
@@ -1,5 +1,5 @@
--- gnome-desktop-2.19.90/configure.in.gnome-bg 2007-08-13 20:04:02.000000000 -0400
-+++ gnome-desktop-2.19.90/configure.in 2007-08-28 13:31:46.000000000 -0400
++++ gnome-desktop-2.19.90/configure.in 2007-08-28 14:01:15.000000000 -0400
@@ -51,10 +51,10 @@
AC_SUBST(GNOME_DISTRIBUTOR)
AC_SUBST(GNOME_DATE)
@@ -16,8 +16,8 @@
# As a special favour for vuntz, support --disable-deprecations
--- /dev/null 2007-08-15 18:04:26.337218222 -0400
-+++ gnome-desktop-2.19.90/libgnome-desktop/gnome-bg.c 2007-08-28 13:42:09.000000000 -0400
-@@ -0,0 +1,1791 @@
++++ gnome-desktop-2.19.90/libgnome-desktop/gnome-bg.c 2007-08-29 16:17:12.000000000 -0400
+@@ -0,0 +1,1824 @@
+/* -*- Mode: C; indent-tabs-mode: t; c-basic-offset: 8; tab-width: 8 -*-
+
+gnomebg.c: Object for the desktop background.
@@ -76,6 +76,9 @@
+ */
+#define GRADIENT_PIXMAP_TILE_SIZE 128
+
++typedef struct FileCacheEntry FileCacheEntry;
++#define CACHE_SIZE 4
++
+/*
+ * Implementation of the GnomeBG class
+ */
@@ -94,7 +97,8 @@
+ time_t uri_mtime;
+ GdkPixbuf * pixbuf_cache;
+ int timeout_id;
-+ GList * file_cache;
++
++ GList * file_cache;
+};
+
+struct _GnomeBGClass
@@ -140,8 +144,8 @@
+ double alpha);
+
+/* Thumbnail utilities */
-+static GdkPixbuf *get_thumbnail_for_uri (GnomeThumbnailFactory *factory,
-+ const char *uri);
++static GdkPixbuf *create_thumbnail_for_uri (GnomeThumbnailFactory *factory,
++ const char *uri);
+static gboolean get_thumb_annotations (GdkPixbuf *thumb,
+ int *orig_width,
+ int *orig_height);
@@ -674,7 +678,7 @@
+ return FALSE;
+
+ uri = bg->uri;
-+ thumb = get_thumbnail_for_uri (factory, uri);
++ thumb = create_thumbnail_for_uri (factory, uri);
+
+ if (!thumb) {
+ SlideShow *show = get_as_slideshow (bg, bg->uri);
@@ -682,7 +686,7 @@
+ double alpha;
+ Slide *slide = get_current_slide (show, &alpha);
+ uri = slide->file1;
-+ thumb = get_thumbnail_for_uri (factory, uri);
++ thumb = create_thumbnail_for_uri (factory, uri);
+ }
+ }
+
@@ -890,7 +894,6 @@
+ THUMBNAIL
+} FileType;
+
-+typedef struct FileCacheEntry FileCacheEntry;
+struct FileCacheEntry
+{
+ FileType type;
@@ -902,6 +905,26 @@
+ } u;
+};
+
++static void
++file_cache_entry_delete (FileCacheEntry *ent)
++{
++ g_free (ent->uri);
++
++ switch (ent->type) {
++ case PIXBUF:
++ g_object_unref (ent->u.pixbuf);
++ break;
++ case SLIDESHOW:
++ slideshow_free (ent->u.slideshow);
++ break;
++ case THUMBNAIL:
++ g_object_unref (ent->u.thumbnail);
++ break;
++ }
++
++ g_free (ent);
++}
++
+static const FileCacheEntry *
+file_cache_lookup (GnomeBG *bg, FileType type, const char *uri)
+{
@@ -910,7 +933,7 @@
+ for (list = bg->file_cache; list != NULL; list = list->next) {
+ FileCacheEntry *ent = list->data;
+
-+ if (ent->type == type && strcmp (ent->uri, uri) == 0)
++ if (ent && ent->type == type && strcmp (ent->uri, uri) == 0)
+ return ent;
+ }
+
@@ -922,10 +945,21 @@
+ const char *uri,
+ GdkPixbuf *pixbuf)
+{
-+ FileCacheEntry *ent = g_new0 (FileCacheEntry, 1);
-+
++ FileCacheEntry *ent;
++
+ g_assert (!file_cache_lookup (bg, PIXBUF, uri));
++
++ while (g_list_length (bg->file_cache) > CACHE_SIZE) {
++ GList *last_link = g_list_last (bg->file_cache);
++ FileCacheEntry *ent = last_link->data;
+
++ file_cache_entry_delete (ent);
++
++ bg->file_cache = g_list_delete_link (bg->file_cache, last_link);
++ }
++
++ ent = g_new0 (FileCacheEntry, 1);
++
+ ent->type = PIXBUF;
+ ent->uri = g_strdup (uri);
+ ent->u.pixbuf = pixbuf;
@@ -1007,7 +1041,7 @@
+ return ent->u.thumbnail;
+ }
+ else {
-+ GdkPixbuf *thumb = get_thumbnail_for_uri (factory, uri);
++ GdkPixbuf *thumb = create_thumbnail_for_uri (factory, uri);
+
+ if (thumb)
+ file_cache_add_thumbnail (bg, uri, thumb);
@@ -1148,7 +1182,7 @@
+ }
+ else {
+ SlideShow *show = get_as_slideshow (bg, bg->uri);
-+ /* FIXME: this code is duplicated in get_pixbuf(). */
++
+ if (show) {
+ double alpha;
+ Slide *slide = get_current_slide (show, &alpha);
@@ -1166,7 +1200,6 @@
+ GdkPixbuf *p1 = get_as_thumbnail (bg, factory, slide->file1);
+ GdkPixbuf *p2 = get_as_thumbnail (bg, factory, slide->file2);
+
-+ /* FIXME: compute thumb */
+ if (p1 && p2) {
+ GdkPixbuf *thumb1, *thumb2;
+
@@ -1741,8 +1774,8 @@
+
+/* Thumbnail utilities */
+static GdkPixbuf *
-+get_thumbnail_for_uri (GnomeThumbnailFactory *factory,
-+ const char *uri)
++create_thumbnail_for_uri (GnomeThumbnailFactory *factory,
++ const char *uri)
+{
+ char *filename;
+ time_t mtime;
@@ -1810,7 +1843,7 @@
+ return FALSE;
+}
--- gnome-desktop-2.19.90/libgnome-desktop/Makefile.am.gnome-bg 2007-08-13 20:04:00.000000000 -0400
-+++ gnome-desktop-2.19.90/libgnome-desktop/Makefile.am 2007-08-28 13:31:46.000000000 -0400
++++ gnome-desktop-2.19.90/libgnome-desktop/Makefile.am 2007-08-28 14:01:15.000000000 -0400
@@ -18,7 +18,8 @@
libgnome_desktop_2_la_SOURCES = \
gnome-desktop-item.c \
@@ -1822,7 +1855,7 @@
libgnome_desktop_2_la_LIBADD = \
$(GNOME_DESKTOP_LIBS)
--- gnome-desktop-2.19.90/libgnome-desktop/libgnomeui/Makefile.am.gnome-bg 2007-08-13 20:04:00.000000000 -0400
-+++ gnome-desktop-2.19.90/libgnome-desktop/libgnomeui/Makefile.am 2007-08-28 13:31:46.000000000 -0400
++++ gnome-desktop-2.19.90/libgnome-desktop/libgnomeui/Makefile.am 2007-08-28 14:01:15.000000000 -0400
@@ -1,4 +1,5 @@
libgnomeui_desktopdir = $(includedir)/gnome-desktop-2.0/libgnomeui
libgnomeui_desktop_HEADERS = \
@@ -1831,7 +1864,7 @@
+ gnome-hint.h \
+ gnome-bg.h
--- /dev/null 2007-08-15 18:04:26.337218222 -0400
-+++ gnome-desktop-2.19.90/libgnome-desktop/libgnomeui/gnome-bg.h 2007-08-28 13:31:46.000000000 -0400
++++ gnome-desktop-2.19.90/libgnome-desktop/libgnomeui/gnome-bg.h 2007-08-28 14:01:15.000000000 -0400
@@ -0,0 +1,99 @@
+/* gnome-bg.h -
+
Index: gnome-desktop.spec
===================================================================
RCS file: /cvs/pkgs/rpms/gnome-desktop/devel/gnome-desktop.spec,v
retrieving revision 1.93
retrieving revision 1.94
diff -u -r1.93 -r1.94
--- gnome-desktop.spec 28 Aug 2007 18:09:51 -0000 1.93
+++ gnome-desktop.spec 29 Aug 2007 20:46:39 -0000 1.94
@@ -125,6 +125,9 @@
%doc %{_datadir}/gtk-doc/html/gnome-desktop/
%changelog
+* Wed Aug 29 2007 Soren Sandmann <sandmann at redhat.com> - 2.19.90-5
+- Fix unbounded caching. Bug 247943.
+
* Tue Aug 28 2007 Soren Sandmann <sandmann at redhat.com> - 2.19.90-4
- Change starttime format to be timezone relative.
More information about the fedora-extras-commits
mailing list