Author: mkrueger
Date: 2007-10-04 08:21:25 -0400 (Thu, 04 Oct 2007)
New Revision: 86869
Modified:
trunk/monodevelop/Core/src/MonoDevelop.Core.Gui/ChangeLog
trunk/monodevelop/Core/src/MonoDevelop.Core.Gui/Freedesktop.RecentFiles/RecentFileStorage.cs
Log:
* Freedesktop.RecentFiles/RecentFileStorage.cs: Made recent file
storage more robust - should fix Bug 330419 - Exception reading the
recent file list.
Modified: trunk/monodevelop/Core/src/MonoDevelop.Core.Gui/ChangeLog
===================================================================
--- trunk/monodevelop/Core/src/MonoDevelop.Core.Gui/ChangeLog 2007-10-04
10:27:46 UTC (rev 86868)
+++ trunk/monodevelop/Core/src/MonoDevelop.Core.Gui/ChangeLog 2007-10-04
12:21:25 UTC (rev 86869)
@@ -1,3 +1,9 @@
+2007-10-04 Mike Krüger <[EMAIL PROTECTED]>
+
+ * Freedesktop.RecentFiles/RecentFileStorage.cs: Made recent file storage
+ more robust - should fix Bug 330419 - Exception reading the recent
file
+ list.
+
2007-09-27 Michael Hutchinson <[EMAIL PROTECTED]>
* MonoDevelop.Core.Gui.mdp: Remove duplicate gtk-sharp reference.
Modified:
trunk/monodevelop/Core/src/MonoDevelop.Core.Gui/Freedesktop.RecentFiles/RecentFileStorage.cs
===================================================================
---
trunk/monodevelop/Core/src/MonoDevelop.Core.Gui/Freedesktop.RecentFiles/RecentFileStorage.cs
2007-10-04 10:27:46 UTC (rev 86868)
+++
trunk/monodevelop/Core/src/MonoDevelop.Core.Gui/Freedesktop.RecentFiles/RecentFileStorage.cs
2007-10-04 12:21:25 UTC (rev 86869)
@@ -107,17 +107,19 @@
ObtainLock ();
try {
bool filteredSomething = false;
- List<RecentItem> store = ReadStore ();
- for (int i = 0; i < store.Count; ++i) {
- if (pred (store[i])) {
- store.RemoveAt (i);
- filteredSomething = true;
- --i;
- continue;
+ List<RecentItem> store = ReadStore (0);
+ if (store != null) {
+ for (int i = 0; i < store.Count; ++i) {
+ if (pred (store[i])) {
+ store.RemoveAt (i);
+ filteredSomething =
true;
+ --i;
+ continue;
+ }
}
+ if (filteredSomething)
+ WriteStore (store);
}
- if (filteredSomething)
- WriteStore (store);
} finally {
ReleaseLock ();
}
@@ -126,11 +128,13 @@
{
ObtainLock ();
try {
- List<RecentItem> store = ReadStore ();
- for (int i = 0; i < store.Count; ++i)
- operation (store[i]);
- if (writeBack)
- WriteStore (store);
+ List<RecentItem> store = ReadStore (0);
+ if (store != null) {
+ for (int i = 0; i < store.Count; ++i)
+ operation (store[i]);
+ if (writeBack)
+ WriteStore (store);
+ }
} finally {
ReleaseLock ();
}
@@ -209,18 +213,18 @@
ObtainLock ();
try {
RemoveItem (item.Uri);
-
- List<RecentItem> store = ReadStore ();
- store.Add (item);
- WriteStore (store);
-
- CheckLimit (group, limit);
+ List<RecentItem> store = ReadStore (0);
+ if (store != null) {
+ store.Add (item);
+ WriteStore (store);
+ CheckLimit (group, limit);
+ }
} finally {
ReleaseLock ();
}
}
-
- List<RecentItem> ReadStore ()
+ const int MAX_TRIES = 5;
+ List<RecentItem> ReadStore (int numberOfTry)
{
Debug.Assert (IsLocked);
List<RecentItem> result = new List<RecentItem> ();
@@ -241,6 +245,13 @@
if (reader.IsStartElement () &&
reader.LocalName == RecentItem.Node)
result.Add (RecentItem.Read
(reader));
}
+ } catch (Exception e) {
+ MonoDevelop.Core.Runtime.LoggingService.Error
((object)"Exception while reading the store", e);
+ if (numberOfTry < MAX_TRIES) {
+ Thread.Sleep (200);
+ return ReadStore (numberOfTry + 1);
+ }
+ return null;
} finally {
if (reader != null)
reader.Close ();
_______________________________________________
Mono-patches maillist - [email protected]
http://lists.ximian.com/mailman/listinfo/mono-patches