[f-spot] avoid throwing and catching a GException on Close ()
- From: Stephane Delcroix <sdelcroix src gnome org>
- To: svn-commits-list gnome org
- Subject: [f-spot] avoid throwing and catching a GException on Close ()
- Date: Wed, 24 Jun 2009 13:37:00 +0000 (UTC)
commit 72312bf91a77d46ff68c941160323a940a4b3933
Author: Stephane Delcroix <stephane delcroix org>
Date: Wed Jun 24 15:33:10 2009 +0200
avoid throwing and catching a GException on Close ()
The defautl gtk# PixbufLoader.Close () used to throw an exception if it can't produce a pixbuf with the data written so far. It's annoying, and expensive, in case we just want to Close the loader in order to dispose it. Gtk#Beans now provides an overload for this.
src/ImageLoader.cs | 11 +++--------
1 files changed, 3 insertions(+), 8 deletions(-)
---
diff --git a/src/ImageLoader.cs b/src/ImageLoader.cs
index bf835df..341da60 100644
--- a/src/ImageLoader.cs
+++ b/src/ImageLoader.cs
@@ -115,12 +115,7 @@ namespace FSpot {
is_disposed = true;
if (image_stream != null)
image_stream.Close ();
- try {
- Close ();
- } catch (GLib.GException) {
- //it's normal to get an exception here if we're closing in the early loading stages, and it's safe to ignore
- // that exception as we don't want the loading to finish but want to cancel it.
- }
+ Close ();
if (thumb != null) {
thumb.Dispose ();
thumb = null;
@@ -138,7 +133,7 @@ namespace FSpot {
ret = true;
}
}
- return ret || base.Close ();
+ return ret || base.Close (true);
}
#endregion
@@ -197,7 +192,7 @@ namespace FSpot {
} else {
try {
if (close_loader)
- base.Close (); //could throw a GException
+ base.Close (true);
else if (!is_disposed && Write (buffer, (ulong)byte_read))
image_stream.BeginRead (buffer, 0, count, HandleReadDone, null);
} catch (System.ObjectDisposedException od) {
[
Date Prev][
Date Next] [
Thread Prev][
Thread Next]
[
Thread Index]
[
Date Index]
[
Author Index]