Browse Source

Fixed exception when QuickClassBrowserPanel panel was refreshing while a partial class was updated by the parser thread.

git-svn-id: svn://svn.sharpdevelop.net/sharpdevelop/branches/2.0@1143 1ccf3a8d-04fe-1044-b7c0-cef0b8235c61
shortcuts
Daniel Grunwald 20 years ago
parent
commit
1a17634102
  1. 4
      src/Main/Base/Project/Src/Services/ParserService/DefaultProjectContent.cs
  2. 2
      src/Main/Base/Project/Src/TextEditor/Gui/Editor/QuickClassBrowserPanel.cs

4
src/Main/Base/Project/Src/Services/ParserService/DefaultProjectContent.cs

@ -300,6 +300,7 @@ namespace ICSharpCode.Core @@ -300,6 +300,7 @@ namespace ICSharpCode.Core
CompoundClass compound = GetClassInternal(fullyQualifiedName, addClass.TypeParameters.Count, language) as CompoundClass;
if (compound != null) {
// possibly replace existing class (look for CU with same filename)
lock (compound) {
for (int i = 0; i < compound.Parts.Count; i++) {
if (compound.Parts[i].CompilationUnit.FileName == addClass.CompilationUnit.FileName) {
compound.Parts[i] = addClass;
@ -310,6 +311,7 @@ namespace ICSharpCode.Core @@ -310,6 +311,7 @@ namespace ICSharpCode.Core
}
compound.Parts.Add(addClass);
compound.UpdateInformationFromParts();
}
LoggingService.Debug("Added new part!");
return;
} else {
@ -460,6 +462,7 @@ namespace ICSharpCode.Core @@ -460,6 +462,7 @@ namespace ICSharpCode.Core
// Use "as" cast to fix SD2-680: the stored class might be a part not marked as partial
CompoundClass compound = GetClassInternal(fullyQualifiedName, @class.TypeParameters.Count, language) as CompoundClass;
if (compound == null) return;
lock (compound) {
compound.Parts.Remove(@class);
if (compound.Parts.Count > 0) {
compound.UpdateInformationFromParts();
@ -468,6 +471,7 @@ namespace ICSharpCode.Core @@ -468,6 +471,7 @@ namespace ICSharpCode.Core
@class = compound; // all parts removed, remove compound class
}
}
}
IClass classInDictionary;
if (!GetClasses(language).TryGetValue(fullyQualifiedName, out classInDictionary)) {

2
src/Main/Base/Project/Src/TextEditor/Gui/Editor/QuickClassBrowserPanel.cs

@ -345,6 +345,7 @@ namespace ICSharpCode.SharpDevelop.DefaultEditor.Gui.Editor @@ -345,6 +345,7 @@ namespace ICSharpCode.SharpDevelop.DefaultEditor.Gui.Editor
}
}
lock (c) {
int lastIndex = 0;
IComparer comparer = new Comparer(System.Globalization.CultureInfo.InvariantCulture);
@ -371,6 +372,7 @@ namespace ICSharpCode.SharpDevelop.DefaultEditor.Gui.Editor @@ -371,6 +372,7 @@ namespace ICSharpCode.SharpDevelop.DefaultEditor.Gui.Editor
}
items.Sort(lastIndex, c.Events.Count, comparer);
lastIndex = items.Count;
}
membersComboBox.BeginUpdate();
membersComboBox.Items.Clear();

Loading…
Cancel
Save