Browse Source

Fixed ObjectDisposedException if user closes SharpDevelop while LoadSolutionProjects thread is running.

git-svn-id: svn://svn.sharpdevelop.net/sharpdevelop/branches/3.0@4250 1ccf3a8d-04fe-1044-b7c0-cef0b8235c61
shortcuts
Daniel Grunwald 17 years ago
parent
commit
44c665f6f5
  1. 2
      src/Main/Base/Project/Src/Internal/Templates/Project/ProjectTemplate.cs
  2. 8
      src/Main/Base/Project/Src/Services/ProjectService/ParseableFileContentEnumerator.cs

2
src/Main/Base/Project/Src/Internal/Templates/Project/ProjectTemplate.cs

@ -398,6 +398,8 @@ namespace ICSharpCode.SharpDevelop.Internal.Templates @@ -398,6 +398,8 @@ namespace ICSharpCode.SharpDevelop.Internal.Templates
projectCreateInformation.Solution.Save();
ProjectService.OnSolutionCreated(new SolutionEventArgs(projectCreateInformation.Solution));
projectCreateInformation.Solution.Dispose();
} else {
project.Dispose();
}
return solutionLocation;
} else {

8
src/Main/Base/Project/Src/Services/ProjectService/ParseableFileContentEnumerator.cs

@ -166,7 +166,13 @@ namespace ICSharpCode.SharpDevelop.Project @@ -166,7 +166,13 @@ namespace ICSharpCode.SharpDevelop.Project
bool IsFileOpen(string fileName)
{
if (viewContentFileNamesCollection == null) {
viewContentFileNamesCollection = WorkbenchSingleton.SafeThreadFunction<IList<string>>(FileService.GetOpenFiles);
try {
viewContentFileNamesCollection = WorkbenchSingleton.SafeThreadFunction<IList<string>>(FileService.GetOpenFiles);
} catch (InvalidOperationException ex) {
// can happen if the user closes SharpDevelop while the parser thread is running
LoggingService.Warn(ex);
viewContentFileNamesCollection = new string[0];
}
}
foreach (string contentName in viewContentFileNamesCollection) {
if (contentName != null) {

Loading…
Cancel
Save