rpms/gnome-desktop/devel refcount-slideshow.patch, NONE, 1.1 gnome-desktop.spec, 1.136, 1.137

Matthias Clasen (mclasen) fedora-extras-commits at redhat.com
Fri Apr 4 18:00:48 UTC 2008


Author: mclasen

Update of /cvs/extras/rpms/gnome-desktop/devel
In directory cvs-int.fedora.redhat.com:/tmp/cvs-serv15943

Modified Files:
	gnome-desktop.spec 
Added Files:
	refcount-slideshow.patch 
Log Message:
Fix caching of slideshows


refcount-slideshow.patch:

--- NEW FILE refcount-slideshow.patch ---
diff -up gnome-desktop-2.22.0/libgnome-desktop/gnome-bg.c.refcount-slideshow gnome-desktop-2.22.0/libgnome-desktop/gnome-bg.c
--- gnome-desktop-2.22.0/libgnome-desktop/gnome-bg.c.refcount-slideshow	2008-04-04 11:50:15.000000000 -0400
+++ gnome-desktop-2.22.0/libgnome-desktop/gnome-bg.c	2008-04-04 11:50:23.000000000 -0400
@@ -820,6 +820,7 @@ gnome_bg_set_pixmap_as_root (GdkScreen *
 /* Implementation of the pixbuf cache */
 struct _SlideShow
 {
+	gint ref_count;
 	double start_time;
 	double total_duration;
 
@@ -834,7 +835,8 @@ struct _SlideShow
 
 static SlideShow *read_slideshow_file (const char *filename,
 				       GError     **err);
-static void       slideshow_free      (SlideShow  *show);
+static void       slideshow_ref       (SlideShow  *show);
+static void       slideshow_unref     (SlideShow  *show);
 
 static double
 now (void)
@@ -929,7 +931,7 @@ file_cache_entry_delete (FileCacheEntry 
 		g_object_unref (ent->u.pixbuf);
 		break;
 	case SLIDESHOW:
-		slideshow_free (ent->u.slideshow);
+		slideshow_unref (ent->u.slideshow);
 		break;
 	case THUMBNAIL:
 		g_object_unref (ent->u.thumbnail);
@@ -1198,7 +1200,11 @@ create_img_thumbnail (GnomeBG           
 			
 			if (show) {
 				double alpha;
-				Slide *slide = get_current_slide (show, &alpha);
+				Slide *slide;
+
+				slideshow_ref (show);
+
+				slide = get_current_slide (show, &alpha);
 
 				if (slide->fixed) {
 					GdkPixbuf *tmp;
@@ -1238,6 +1244,8 @@ create_img_thumbnail (GnomeBG           
 				}
 
 				ensure_timeout (bg, slide);
+
+				slideshow_unref (show);
 			}
 		}
 
@@ -1309,7 +1317,11 @@ get_pixbuf (GnomeBG *bg)
 
 			if (show) {
 				double alpha;
-				Slide *slide = get_current_slide (show, &alpha);
+				Slide *slide;
+
+				slideshow_ref (show);
+
+				slide = get_current_slide (show, &alpha);
 
 				if (slide->fixed) {
 					FileSize *size;
@@ -1332,6 +1344,8 @@ get_pixbuf (GnomeBG *bg)
 				}
 
 				ensure_timeout (bg, slide);
+
+				slideshow_unref (show);
 			}
 		}
 	}
@@ -1819,12 +1833,22 @@ handle_text (GMarkupParseContext *contex
 }
 
 static void
-slideshow_free (SlideShow *show)
+slideshow_ref (SlideShow *show)
+{
+	show->ref_count++;
+}
+
+static void
+slideshow_unref (SlideShow *show)
 {
 	GList *list;
 	GSList *slist;
 	FileSize *size;
 	
+	show->ref_count--;
+	if (show->ref_count > 0)
+		return;
+
 	for (list = show->slides->head; list != NULL; list = list->next) {
 		Slide *slide = list->data;
 		for (slist = slide->file1; slist != NULL; slist = slist->next) {
@@ -1933,6 +1957,7 @@ read_slideshow_file (const char *uri,
 	g_object_unref (file);
 	
 	show = g_new0 (SlideShow, 1);
+	show->ref_count = 1;
 	threadsafe_localtime ((time_t)0, &show->start_tm);
 	show->stack = g_queue_new ();
 	show->slides = g_queue_new ();
@@ -1940,13 +1965,13 @@ read_slideshow_file (const char *uri,
 	context = g_markup_parse_context_new (&parser, 0, show, NULL);
 	
 	if (!g_markup_parse_context_parse (context, contents, len, err)) {
-		slideshow_free (show);
+		slideshow_unref (show);
 		show = NULL;
 	}
 	
 	if (show) {
 		if (!g_markup_parse_context_end_parse (context, err)) {
-			slideshow_free (show);
+			slideshow_unref (show);
 			show = NULL;
 		}
 	}


Index: gnome-desktop.spec
===================================================================
RCS file: /cvs/extras/rpms/gnome-desktop/devel/gnome-desktop.spec,v
retrieving revision 1.136
retrieving revision 1.137
diff -u -r1.136 -r1.137
--- gnome-desktop.spec	30 Mar 2008 01:10:10 -0000	1.136
+++ gnome-desktop.spec	4 Apr 2008 17:59:57 -0000	1.137
@@ -12,7 +12,7 @@
 Summary: Package containing code shared among gnome-panel, gnome-session, nautilus, etc
 Name: gnome-desktop
 Version: 2.22.0
-Release: 4%{?dist}
+Release: 5%{?dist}
 URL: http://www.gnome.org
 Source0: http://download.gnome.org/sources/gnome-desktop/2.22/%{name}-%{version}.tar.bz2
 License: GPLv2+ and LGPLv2+
@@ -26,6 +26,8 @@
 # fixed upstream
 Patch6:   gnome-desktop-2.22.0-future.patch
 
+Patch7:   refcount-slideshow.patch
+
 Requires: redhat-menus
 
 Obsoletes: gnome-core gnome-core-devel
@@ -80,6 +82,7 @@
 %patch4 -p1 -b .multires
 %patch5 -p1 -b .mistranslation
 %patch6 -p1 -b .future
+%patch7 -p1 -b .refcount-slideshow
 
 %build
 autoreconf
@@ -126,6 +129,9 @@
 %doc %{_datadir}/gtk-doc/html/gnome-desktop/
 
 %changelog
+* Fri Apr  4 2008 Matthias Clasen <mclasen at redhat.com> - 2.22.0-5
+- Fix some logic errors wrt to caching of slideshows that
+  may cause nautilus crashes
 * Sat Mar 29 2008 Matthias Clasen <mclasen at redhat.com> - 2.22.0-4
 - Handle slideshow start times in the future correctly
 




More information about the fedora-extras-commits mailing list