diff options
author | Andrés G. Aragoneses <knocte@gmail.com> | 2011-07-22 03:11:12 +0400 |
---|---|---|
committer | Andrés G. Aragoneses <knocte@gmail.com> | 2011-07-22 03:11:12 +0400 |
commit | 2bf0f4b5c56c56473e0a055f0f987309f3dd366a (patch) | |
tree | 178b428ce5be54b32711500a1421c4219fa2dc4c | |
parent | b6cc950ec3b09573045614098418a66a65de0e10 (diff) |
Fix Repair() to prevent crashing when looking for addin descriptions
This modification fixes a bug in the Repair method. The bug was very
hard to catch, as a very low rate of banshee users could hit it.
However, since the LatestVersion-checking feature was committed (which
was implemented by commit in
https://github.com/mono/mono-addins/commit/a4f3b3c46e5e798b1378941a2f99bcce1492c903
and bisected by Iain Lane in
http://bugs.debian.org/cgi-bin/bugreport.cgi?bug=630590), the
bug was exposed as 100% reproducible in debug mode ('banshee --debug').
This LatestVersion-feature introduced the possibility that addins could
query the addins collections when asked for their Enabled property (to
find other sibling-addins with different versions), which made the
Repair() method crash, as it firstly removes the AddinCache folders, and
after that it tries to update the database by looking at their content
(and the content was removed by itself). Before the
LatestVersion-feature was introduced, this bug would not be hit so often
because it was less likely to find a non-empty "allSetupInfos"
cache-variable combined with an empty "addinSetupInfos" cache-variable.
Both circumstances happening at the same time would cause an
Addin.ReadFromDescription() call, while iterating over the cached addins
to find if each addin is not root.
Fixes http://monoaddins.codeplex.com/workitem/6901 .
-rw-r--r-- | Mono.Addins/Mono.Addins.Database/AddinDatabase.cs | 11 |
1 files changed, 9 insertions, 2 deletions
diff --git a/Mono.Addins/Mono.Addins.Database/AddinDatabase.cs b/Mono.Addins/Mono.Addins.Database/AddinDatabase.cs index 91dd779..2ce6e85 100644 --- a/Mono.Addins/Mono.Addins.Database/AddinDatabase.cs +++ b/Mono.Addins/Mono.Addins.Database/AddinDatabase.cs @@ -940,12 +940,17 @@ namespace Mono.Addins.Database } return lastDomainId.ToString (); } - - internal void ResetCachedData () + + internal void ResetBasicCachedData () { allSetupInfos = null; addinSetupInfos = null; rootSetupInfos = null; + } + + internal void ResetCachedData () + { + ResetBasicCachedData (); hostIndex = null; cachedAddinSetupInfos.Clear (); if (addinEngine != null) @@ -1001,6 +1006,8 @@ namespace Mono.Addins.Database monitor.ReportError ("The add-in registry could not be rebuilt. It may be due to lack of write permissions to the directory: " + AddinDbDir, ex); } } + ResetBasicCachedData (); + Update (monitor, domain); } |