[f-spot/FSPOT_0_6_0_STABLE] avoid crashing if system contains the same color profile more than once



commit 9949677211367b1445362bd6c1569aa225467594
Author: Stephane Delcroix <stephane delcroix org>
Date:   Fri Aug 14 13:27:33 2009 +0200

    avoid crashing if system contains the same color profile more than once
    
    this fix bgo591424

 src/Core/ColorManagement.cs |   15 +++++++++++----
 1 files changed, 11 insertions(+), 4 deletions(-)
---
diff --git a/src/Core/ColorManagement.cs b/src/Core/ColorManagement.cs
index 064f02e..2c1bfed 100644
--- a/src/Core/ColorManagement.cs
+++ b/src/Core/ColorManagement.cs
@@ -25,13 +25,20 @@ namespace FSpot {
 				if (profiles == null) {
 					profiles = new Dictionary<string, Cms.Profile> ();
 					Cms.Profile p = Cms.Profile.CreateStandardRgb ();
-					profiles.Add (p.ProductName, p);
+					if (!profiles.ContainsKey (p.ProductName))
+						profiles.Add (p.ProductName, p);
+
 					p = Cms.Profile.CreateAlternateRgb ();
-					profiles.Add (p.ProductName, p);
+					if (!profiles.ContainsKey (p.ProductName))
+						profiles.Add (p.ProductName, p);
+
 					foreach (var path in search_dir)
-						AddProfiles (path, profiles);
+						if (!profiles.ContainsKey (path))
+							AddProfiles (path, profiles);
+
 					if (XProfile != null)
-						profiles.Add ("_x_profile_", XProfile);
+						if (!profiles.ContainsKey ("_x_profile_"))
+							profiles.Add ("_x_profile_", XProfile);
 				}
 				return profiles;
 			}



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