f-spot r4298 - in trunk: . src/Widgets



Author: rubenv
Date: Tue Aug 26 14:40:16 2008
New Revision: 4298
URL: http://svn.gnome.org/viewvc/f-spot?rev=4298&view=rev

Log:
2008-08-26  Ruben Vermeersch  <ruben savanne be>

	* Widgets/InfoBox.cs: Prevent a possible race condition, where a second
	thread updates the histogram while it's in use.

Modified:
   trunk/ChangeLog
   trunk/src/Widgets/InfoBox.cs

Modified: trunk/src/Widgets/InfoBox.cs
==============================================================================
--- trunk/src/Widgets/InfoBox.cs	(original)
+++ trunk/src/Widgets/InfoBox.cs	Tue Aug 26 14:40:16 2008
@@ -457,16 +457,18 @@
 
 			Photo photo = Photos[0];
 
+			Gdk.Pixbuf hint = histogram_hint;
+			histogram_hint = null;
+
 			try {
-				if (histogram_hint == null)
+				if (hint == null)
 					using (ImageFile img = ImageFile.Create (photo.DefaultVersionUri))
-						histogram_hint = img.Load (256, 256);
+						hint = img.Load (256, 256);
 
 				int max = histogram_expander.Allocation.Width;
-				histogram_image.Pixbuf = histogram.Generate (histogram_hint, max);
+				histogram_image.Pixbuf = histogram.Generate (hint, max);
 
-				histogram_hint.Dispose ();
-				histogram_hint = null;
+				hint.Dispose ();
 			} catch (System.Exception e) {
 				Log.Debug (e.StackTrace);
 			}



[Date Prev][Date Next]   [Thread Prev][Thread Next]   [Thread Index] [Date Index] [Author Index]