[f-spot/stable-0.8] Don't crash if the import window was closed before sources are populated.



commit 6fbfe73d82d4dea128ac8f664a44c65d7d0d652f
Author: Ruben Vermeersch <ruben savanne be>
Date:   Fri Oct 22 17:20:11 2010 +0200

    Don't crash if the import window was closed before sources are populated.
    
    https://bugzilla.gnome.org/show_bug.cgi?id=632905

 .../MainApp/FSpot.UI.Dialog/ImportDialog.cs        |   11 +++++++++--
 1 files changed, 9 insertions(+), 2 deletions(-)
---
diff --git a/src/Clients/MainApp/FSpot.UI.Dialog/ImportDialog.cs b/src/Clients/MainApp/FSpot.UI.Dialog/ImportDialog.cs
index 2fe955d..194b8c7 100644
--- a/src/Clients/MainApp/FSpot.UI.Dialog/ImportDialog.cs
+++ b/src/Clients/MainApp/FSpot.UI.Dialog/ImportDialog.cs
@@ -115,8 +115,14 @@ namespace FSpot.UI.Dialog
             sources_combo.SetAttributes (render2, "text", 1, "sensitive", 3);
 
             GLib.Idle.Add (() => {
-                PopulateSourceCombo (null);
-                QueueDraw ();
+                try {
+                    PopulateSourceCombo (null);
+                    QueueDraw ();
+                } catch (Exception e) {
+                    // Swallow the exception if the import was cancelled / dialog was closed.
+                    if (Controller != null)
+                        throw e;
+                }
                 return false;
             });
         }
@@ -177,6 +183,7 @@ namespace FSpot.UI.Dialog
                 dialog.Title = Catalog.GetString ("Warning");
                 dialog.Response += (s, arg) => {
                     dialog.Destroy ();
+                    Controller = null;
                 };
                 dialog.Run ();
             };



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