beagle r4567 - in trunk/beagle: Util beagled/EvolutionMailQueryable



Author: dbera
Date: Fri Feb 29 13:00:02 2008
New Revision: 4567
URL: http://svn.gnome.org/viewvc/beagle?rev=4567&view=rev

Log:
* SafeProcess.cs: Fix serious typo.
* EvolutionMailQueryable.cs: The generator list could change during computation of status, so lock it. The generator list is not a heavily used resource so this should be fine.


Modified:
   trunk/beagle/Util/SafeProcess.cs
   trunk/beagle/beagled/EvolutionMailQueryable/EvolutionMailQueryable.cs

Modified: trunk/beagle/Util/SafeProcess.cs
==============================================================================
--- trunk/beagle/Util/SafeProcess.cs	(original)
+++ trunk/beagle/Util/SafeProcess.cs	Fri Feb 29 13:00:02 2008
@@ -128,7 +128,7 @@
 				env = new string [env_dict.Count + 2];
 				int count = 0;
 				foreach (DictionaryEntry entry in env_dict)
-					if (entry.Key != "LANG")
+					if ((string) entry.Key != "LANG")
 						env [count ++] = String.Concat (entry.Key, "=", entry.Value);
 
 				env [count ++] = "LANG=C";

Modified: trunk/beagle/beagled/EvolutionMailQueryable/EvolutionMailQueryable.cs
==============================================================================
--- trunk/beagle/beagled/EvolutionMailQueryable/EvolutionMailQueryable.cs	(original)
+++ trunk/beagle/beagled/EvolutionMailQueryable/EvolutionMailQueryable.cs	Fri Feb 29 13:00:02 2008
@@ -170,7 +170,8 @@
 
 		internal void AddGenerator (EvolutionMailIndexableGenerator generator, bool inotify_event)
 		{
-			running_generators.Add (generator);
+			lock (running_generators)
+				running_generators.Add (generator);
 
 			if (! inotify_event)
 				IsIndexing = true;
@@ -178,28 +179,32 @@
 
 		internal void RemoveGenerator (EvolutionMailIndexableGenerator generator)
 		{
-			running_generators.Remove (generator);
+			lock (running_generators) {
+				running_generators.Remove (generator);
 
-			if (running_generators.Count == 0)
-				IsIndexing = false;
+				if (running_generators.Count == 0)
+					IsIndexing = false;
+			}
 		}
 
 		protected override int ProgressPercent {
 			get {
-				if (running_generators.Count == 0)
-					return -1;
-
-				// An embarrassingly unscientific attempt at getting progress
-				// information from the mail backend as a whole.  Unfortunately
-				// the IMAP and mbox backends don't have a common unit of
-				// measurement (IMAP has number of messages, mbox number of
-				// bytes), so we can't get anything really accurate.
-				double total_percent = 0;
+				lock (running_generators) {
+					if (running_generators.Count == 0)
+						return -1;
+
+					// An embarrassingly unscientific attempt at getting progress
+					// information from the mail backend as a whole.  Unfortunately
+					// the IMAP and mbox backends don't have a common unit of
+					// measurement (IMAP has number of messages, mbox number of
+					// bytes), so we can't get anything really accurate.
+					double total_percent = 0;
 
-				foreach (EvolutionMailIndexableGenerator generator in running_generators)
-					total_percent += generator.ProgressPercent;
+					foreach (EvolutionMailIndexableGenerator generator in running_generators)
+						total_percent += generator.ProgressPercent;
 
-				return (int) (total_percent / running_generators.Count);
+					return (int) (total_percent / running_generators.Count);
+				}
 			}
 		}
 



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