[f-spot/rubenv-gsoc-2009: 69/86] Some more bugfixes related to disposing.



commit 29e60e91db348ddac927d48a4aa9a7d0baed3aba
Author: Ruben Vermeersch <ruben savanne be>
Date:   Wed Aug 12 13:55:06 2009 +0200

    Some more bugfixes related to disposing.

 src/Core/Photo.cs             |    7 ++++++-
 src/Loaders/GdkImageLoader.cs |    3 +++
 src/PhotoStore.cs             |    2 ++
 src/PhotoVersionCommands.cs   |    2 ++
 4 files changed, 13 insertions(+), 1 deletions(-)
---
diff --git a/src/Core/Photo.cs b/src/Core/Photo.cs
index f0345f3..53e19d4 100644
--- a/src/Core/Photo.cs
+++ b/src/Core/Photo.cs
@@ -5,10 +5,13 @@
  *	Ettore Perazzoli <ettore perazzoli org>
  *	Larry Ewing <lewing gnome org>
  *	Stephane Delcroix <stephane delcroix org>
+ *	Ruben Vermeersch <ruben savanne be>
  * 
  * This is free software. See COPYING for details.
  */
 
+using Gdk;
+
 using System;
 using System.IO;
 using System.Linq;
@@ -418,7 +421,9 @@ namespace FSpot
 				GLib.File source = GLib.FileFactory.NewForUri (original_uri);
 				source.Copy (destination, GLib.FileCopyFlags.None, null, null);
 	
-				FSpot.ThumbnailGenerator.Create (new_uri).Dispose ();
+				Pixbuf thumb = FSpot.ThumbnailGenerator.Create (new_uri);
+				if (thumb != null)
+					thumb.Dispose ();
 			}
 
 			uint version_id = HighestVersionId + 1;
diff --git a/src/Loaders/GdkImageLoader.cs b/src/Loaders/GdkImageLoader.cs
index ddcf643..bef16c5 100644
--- a/src/Loaders/GdkImageLoader.cs
+++ b/src/Loaders/GdkImageLoader.cs
@@ -83,6 +83,9 @@ namespace FSpot.Loaders {
 				return;
 
 			is_disposed = true;
+			while (Loading)
+				;
+
 			if (image_stream != null)
 				try {
 					image_stream.Close ();
diff --git a/src/PhotoStore.cs b/src/PhotoStore.cs
index f426115..07b6aa1 100644
--- a/src/PhotoStore.cs
+++ b/src/PhotoStore.cs
@@ -268,6 +268,8 @@ public class PhotoStore : DbStore<Photo> {
 				Photo photo = Get (photo_id);
 				PhotoVersion version = photo.GetVersion (version_id, true);
 
+				Log.Debug ("[CleanHidden] P: {0}, V: {1}, RefCount: {2}", photo_id, version_id, VersionRefCount (version));
+
 				if (VersionRefCount (version) == 0) {
 					photo.FullyDeleteVersion (version_id, false);
 					Database.ExecuteNonQuery (new DbCommand ("DELETE FROM photo_versions WHERE photo_id = :photo_id AND version_id = :version_id", "photo_id", photo_id, "version_id", version_id));
diff --git a/src/PhotoVersionCommands.cs b/src/PhotoVersionCommands.cs
index ddd26d1..781863d 100644
--- a/src/PhotoVersionCommands.cs
+++ b/src/PhotoVersionCommands.cs
@@ -110,6 +110,8 @@ public class PhotoVersionCommands
 					string msg = Catalog.GetString ("Could not create a new version");
 					string desc = String.Format (Catalog.GetString ("Received exception \"{0}\". Unable to create version \"{1}\""),
 								     e.Message, name);
+
+					Log.Debug ("{0}", e);
 					
 					HigMessageDialog md = new HigMessageDialog (parent_window, DialogFlags.DestroyWithParent, 
 										    Gtk.MessageType.Error, ButtonsType.Ok, 



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