[mono/monodevelop] 54752c0a: [Core] Fix crash in the project buidler finalizer

"Lluis Sanchez ([email protected])" <[email protected]>
Newsgroups gmane.comp.gnome.mono.patches
Message-ID <00000141984e6520-29684cb2-95db-40ae-9d1b-ff5f6b10697d-000000@email.amazonses.com>
   Branch: refs/heads/master
     Home: https://github.com/mono/monodevelop
  Compare: https://github.com/mono/monodevelop/compare/a89b068516a7...54752c0af203

   Commit: 54752c0af203703d5fec5e339e6b5349dbb070fd
   Author: Lluis Sanchez <[email protected]> (slluis)
     Date: 2013-10-08 13:41:22 GMT
      URL: https://github.com/mono/monodevelop/commit/54752c0af203703d5fec5e339e6b5349dbb070fd

[Core] Fix crash in the project buidler finalizer

Changed paths:
  M main/src/core/MonoDevelop.Core/MonoDevelop.Projects.Formats.MSBuild/MSBuildProjectService.cs
  M main/src/core/MonoDevelop.Core/MonoDevelop.Projects.Formats.MSBuild/RemoteProjectBuilder.cs

Modified: main/src/core/MonoDevelop.Core/MonoDevelop.Projects.Formats.MSBuild/MSBuildProjectService.cs
===================================================================
@@ -58,6 +58,8 @@ public static class MSBuildProjectService
 		
 		static Dictionary<string,RemoteBuildEngine> builders = new Dictionary<string, RemoteBuildEngine> ();
 		static GenericItemTypeNode genericItemTypeNode = new GenericItemTypeNode ();
+
+		internal static bool ShutDown { get; private set; }
 		
 		public static DataContext DataContext {
 			get {
@@ -86,6 +88,7 @@ static MSBuildProjectService ()
 			DefaultMSBuildVerbosity = PropertyService.Get ("MonoDevelop.Ide.MSBuildVerbosity", MSBuildVerbosity.Normal);
 
 			Runtime.ShuttingDown += delegate {
+				ShutDown = true;
 				CleanProjectBuilders ();
 			};
 		}

Modified: main/src/core/MonoDevelop.Core/MonoDevelop.Projects.Formats.MSBuild/RemoteProjectBuilder.cs
===================================================================
@@ -103,10 +103,14 @@ public void RefreshWithContent (string projectContent)
 
 		public void Dispose ()
 		{
-			if (engine != null) {
-				if (builder != null)
-					engine.UnloadProject (builder);
-				MSBuildProjectService.ReleaseProjectBuilder (engine);
+			if (!MSBuildProjectService.ShutDown && engine != null) {
+				try {
+					if (builder != null)
+						engine.UnloadProject (builder);
+					MSBuildProjectService.ReleaseProjectBuilder (engine);
+				} catch {
+					// Ignore
+				}
 				GC.SuppressFinalize (this);
 				engine = null;
 				builder = null;


_______________________________________________
Mono-patches maillist  -  [email protected]
http://lists.ximian.com/mailman/listinfo/mono-patches
lmpx.com only provides a reader for public news (NNTP) servers. It is not affiliated with the servers or forums shown here and is not responsible for the content of articles, which is written by their respective authors.