[f-spot/rubenv-gsoc-2009: 63/86] Fix a potential hang, add some implementation guidelines.



commit 005ff344ac52b365fd4d1627127f23c259a6eead
Author: Ruben Vermeersch <ruben savanne be>
Date:   Tue Aug 11 15:00:48 2009 +0200

    Fix a potential hang, add some implementation guidelines.

 src/Loaders/IImageLoader.cs      |   13 +++++++++++--
 src/Loaders/LibrawImageLoader.cs |    1 +
 2 files changed, 12 insertions(+), 2 deletions(-)
---
diff --git a/src/Loaders/IImageLoader.cs b/src/Loaders/IImageLoader.cs
index d18be79..0f10b1c 100644
--- a/src/Loaders/IImageLoader.cs
+++ b/src/Loaders/IImageLoader.cs
@@ -15,6 +15,9 @@ using Gdk;
 
 namespace FSpot.Loaders {
 	public interface IImageLoader : IDisposable {
+		// Completed is always emitted, either when the loading is completed,
+		// or when an error is occured. Requesting the relevant item and
+		// checking for a NULL value should always be done.
 		event EventHandler<AreaPreparedEventArgs> AreaPrepared;
 		event EventHandler<AreaUpdatedEventArgs> AreaUpdated;
 		event EventHandler<ItemsCompletedEventArgs> Completed;
@@ -22,11 +25,17 @@ namespace FSpot.Loaders {
 
 		ImageLoaderItem Load (ImageLoaderItem items, bool async);
 
+		// Each of these properties should return a pixbuf that should be
+		// disposed by the requestor.
+		//
+		// If something goes wrong with the loading or if the item isn't loaded
+		// yet, NULL should be returned.
 		Pixbuf Thumbnail { get; }
-		PixbufOrientation ThumbnailOrientation { get; }
 		Pixbuf Large { get; }
-		PixbufOrientation LargeOrientation { get; }
 		Pixbuf Full { get; }
+
+		PixbufOrientation ThumbnailOrientation { get; }
+		PixbufOrientation LargeOrientation { get; }
 		PixbufOrientation FullOrientation { get; }
 	}
 }
diff --git a/src/Loaders/LibrawImageLoader.cs b/src/Loaders/LibrawImageLoader.cs
index f72976b..ef16d8f 100644
--- a/src/Loaders/LibrawImageLoader.cs
+++ b/src/Loaders/LibrawImageLoader.cs
@@ -251,6 +251,7 @@ namespace FSpot.Loaders {
 			full = loader.LoadFull ();
 			FullOrientation = PixbufOrientation.TopLeft;
 			if (full == null) {
+				SignalItemCompleted (ImageLoaderItem.Full);
 				return;
 			}
 



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