[mono/monodevelop] ae9523c2: Fixed 'Bug 16061 - Opening our solution locks up Xamarin Studio on

Mike Krüger ([email protected]) <[email protected]> Mon, 11 Nov 2013 13:15:33 +0000
Newsgroups gmane.comp.gnome.mono.patches
Message-ID <00000142474d8c64-6ab60a24-49ce-4ab8-b688-1bb702c3ab92-000000@email.amazonses.com>
   Branch: refs/heads/master
     Home: https://github.com/mono/monodevelop
  Compare: https://github.com/mono/monodevelop/compare/eeccd5f119f7...ae9523c2fa28

   Commit: ae9523c2fa288c3bdcb3399d7b12ce9cbfbe4d2f
   Author: Mike Krüger <[email protected]> (mkrueger)
     Date: 2013-11-11 13:13:58 GMT
      URL: https://github.com/mono/monodevelop/commit/ae9523c2fa288c3bdcb3399d7b12ce9cbfbe4d2f

Fixed 'Bug 16061 - Opening our solution locks up Xamarin Studio on
4.2.0, high CPU (180%+) and lots of threads'

Changed paths:
  M main/src/core/MonoDevelop.Ide/MonoDevelop.Ide.TypeSystem/TypeSystemService.cs

Modified: main/src/core/MonoDevelop.Ide/MonoDevelop.Ide.TypeSystem/TypeSystemService.cs
===================================================================
@@ -939,10 +939,18 @@ public class ProjectContentWrapper
 
 			public bool ReferencesConnected {
 				get {
-					return referencesConnected && referencedWrappers.All (w => w.ReferencesConnected);
+					return GetReferencesConnected (this, new HashSet<ProjectContentWrapper> ());
 				}
 			}
 
+			static bool GetReferencesConnected (ProjectContentWrapper pcw, HashSet<ProjectContentWrapper> wrapper)
+			{
+				if (wrapper.Contains (pcw))
+					return true;
+				wrapper.Add (pcw); 
+				return pcw.referencesConnected && pcw.referencedWrappers.All (w => GetReferencesConnected (w, wrapper));
+			}
+
 			public IProjectContent Content {
 				get {
 					if (!referencesConnected) {
@@ -2693,22 +2701,22 @@ static void CheckModifiedFiles (Project project, ProjectFile[] projectFiles, Pro
 			content.RunWhenLoaded (delegate(IProjectContent cnt) {
 				try {
 					content.LoadOperationDepth++;
-					var modifiedFiles = new List<ProjectFile> ();
-					var oldFileNewFile = new List<Tuple<ProjectFile, IUnresolvedFile>> ();
-
+					var modifiedFiles = new List<ProjectFile> ();
+					var oldFileNewFile = new List<Tuple<ProjectFile, IUnresolvedFile>> ();
+
 					foreach (var file in projectFiles) {
 						if (file.BuildAction == null)
 							continue;
 						// if the file is already inside the content a parser exists for it, if not check if it can be parsed.
-						var oldFile = cnt.GetFile (file.Name);
+						var oldFile = cnt.GetFile (file.Name);
 						oldFileNewFile.Add (Tuple.Create (file, oldFile));
 					}
 
 					// This is disk intensive and slow
 					oldFileNewFile.RemoveAll (t => !IsFileModified (t.Item1, t.Item2));
 
-					foreach (var v in oldFileNewFile) {
-						var file = v.Item1;
+					foreach (var v in oldFileNewFile) {
+						var file = v.Item1;
 						var oldFile = v.Item2;
 						if (oldFile == null) {
 							var parser = TypeSystemService.GetParser (DesktopService.GetMimeTypeForUri (file.Name), file.BuildAction);
_______________________________________________
Mono-patches maillist  -  [email protected]
http://lists.ximian.com/mailman/listinfo/mono-patches