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



Author: lewing
Date: Tue Dec 30 21:40:05 2008
New Revision: 4680
URL: http://svn.gnome.org/viewvc/f-spot?rev=4680&view=rev

Log:
2008-12-30  Larry Ewing  <lewing novell com>

        * src/Widgets/InfoBox.cs: create a null histogram image if
        something goes wrong in the normal case.

        * src/Widgets/MetadataDisplay.cs: don't crash when quickly
        thumbing through missing files.



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

Modified: trunk/src/Widgets/InfoBox.cs
==============================================================================
--- trunk/src/Widgets/InfoBox.cs	(original)
+++ trunk/src/Widgets/InfoBox.cs	Tue Dec 30 21:40:05 2008
@@ -693,18 +693,22 @@
 
 			Gdk.Pixbuf hint = histogram_hint;
 			histogram_hint = null;
+			int max = histogram_expander.Allocation.Width;
 
 			try {
 				if (hint == null)
 					using (ImageFile img = ImageFile.Create (photo.DefaultVersionUri))
 						hint = img.Load (256, 256);
-
-				int max = histogram_expander.Allocation.Width;
+				
 				histogram_image.Pixbuf = histogram.Generate (hint, max);
-
+				
 				hint.Dispose ();
 			} catch (System.Exception e) {
 				FSpot.Utils.Log.Debug (e.StackTrace);
+				using (Gdk.Pixbuf empty = new Gdk.Pixbuf (Gdk.Colorspace.Rgb, true, 8, 256, 256)) {
+					empty.Fill (0x0);
+					histogram_image.Pixbuf = histogram.Generate (empty, max);
+				}
 			}
 
 			return false;

Modified: trunk/src/Widgets/MetadataDisplay.cs
==============================================================================
--- trunk/src/Widgets/MetadataDisplay.cs	(original)
+++ trunk/src/Widgets/MetadataDisplay.cs	Tue Dec 30 21:40:05 2008
@@ -122,8 +122,10 @@
 			set {
 				photo = value;
 
-				if (exif_info != null)
+				if (exif_info != null) {
 					exif_info.Dispose ();
+					exif_info = null;
+				}
 
 				if (photo != null) {
 					if (File.Exists (photo.DefaultVersionUri.LocalPath))



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