Browse Source

Fixed crash when closing the solution while building.

git-svn-id: svn://svn.sharpdevelop.net/sharpdevelop/trunk@2704 1ccf3a8d-04fe-1044-b7c0-cef0b8235c61
shortcuts
Daniel Grunwald 19 years ago
parent
commit
22eed44cab
  1. 12
      src/Main/Base/Project/Src/Project/BuildEngine.cs
  2. 5
      src/Main/Base/Project/Src/Services/ProjectService/ProjectService.cs

12
src/Main/Base/Project/Src/Project/BuildEngine.cs

@ -106,8 +106,8 @@ namespace ICSharpCode.SharpDevelop.Project @@ -106,8 +106,8 @@ namespace ICSharpCode.SharpDevelop.Project
{
EventHandler eh = null;
lock (lockObject) {
if (isCancelAllowed) {
ICSharpCode.Core.LoggingService.Debug("");
if (isCancelAllowed && !isCancelled) {
ICSharpCode.Core.LoggingService.Debug("Cancel build");
isCancelled = true;
eh = Cancelled;
}
@ -493,9 +493,11 @@ namespace ICSharpCode.SharpDevelop.Project @@ -493,9 +493,11 @@ namespace ICSharpCode.SharpDevelop.Project
return;
buildIsDone = true;
}
foreach (BuildNode n in nodeDict.Values) {
if (!n.buildFinished) {
throw new Exception("All workers done, but a project did not finish building");
if (!buildIsCancelled) {
foreach (BuildNode n in nodeDict.Values) {
if (!n.buildFinished) {
throw new Exception("All workers done, but a project did not finish building");
}
}
}
string buildTime = " (" + (DateTime.Now - buildStart).ToString() + ")";

5
src/Main/Base/Project/Src/Services/ProjectService/ProjectService.cs

@ -460,6 +460,11 @@ namespace ICSharpCode.SharpDevelop.Project @@ -460,6 +460,11 @@ namespace ICSharpCode.SharpDevelop.Project
public static void CloseSolution()
{
// If a build is running, cancel it.
// If we would let a build run but unload the MSBuild projects, the next project.StartBuild call
// could cause an exception.
BuildEngine.CancelGuiBuild();
if (openSolution != null) {
CurrentProject = null;
OnSolutionClosing(new SolutionEventArgs(openSolution));

Loading…
Cancel
Save