[banshee] [SourceManager] Catch exceptions with extension sources



commit 9aa9c5369c4d1e2ce8990e1870b1893769b0a433
Author: Gabriel Burt <gabriel burt gmail com>
Date:   Tue Aug 24 12:59:34 2010 -0500

    [SourceManager] Catch exceptions with extension sources
    
    Fixes bgo#626791 where the AmazonMp3.Store extension would throw an
    exception when we tried to load it if the AmazonMp3 (downloader)
    extension was somehow disabled.

 .../Banshee.Sources/SourceManager.cs               |   22 ++++++++++---------
 1 files changed, 12 insertions(+), 10 deletions(-)
---
diff --git a/src/Core/Banshee.Services/Banshee.Sources/SourceManager.cs b/src/Core/Banshee.Services/Banshee.Sources/SourceManager.cs
index d1ef5da..0086f83 100644
--- a/src/Core/Banshee.Services/Banshee.Sources/SourceManager.cs
+++ b/src/Core/Banshee.Services/Banshee.Sources/SourceManager.cs
@@ -125,16 +125,18 @@ namespace Banshee.Sources
                 TypeExtensionNode node = (TypeExtensionNode)args.ExtensionNode;
 
                 if (args.Change == ExtensionChange.Add && !extension_sources.ContainsKey (node.Id)) {
-                    Source source = (Source)node.CreateInstance ();
-                    extension_sources.Add (node.Id, source);
-                    bool add_source = true;
-                    if (source.Properties.Contains ("AutoAddSource")) {
-                        add_source = source.Properties.GetBoolean ("AutoAddSource");
-                    }
-                    if (add_source) {
-                        AddSource (source);
-                    }
-                    Log.DebugFormat ("Extension source loaded: {0}", source.Name);
+                    try {
+                        Source source = (Source)node.CreateInstance ();
+                        extension_sources.Add (node.Id, source);
+                        bool add_source = true;
+                        if (source.Properties.Contains ("AutoAddSource")) {
+                            add_source = source.Properties.GetBoolean ("AutoAddSource");
+                        }
+                        if (add_source) {
+                            AddSource (source);
+                        }
+                        Log.DebugFormat ("Extension source loaded: {0}", source.Name);
+                    } catch {}
                 } else if (args.Change == ExtensionChange.Remove && extension_sources.ContainsKey (node.Id)) {
                     Source source = extension_sources[node.Id];
                     extension_sources.Remove (node.Id);



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