[svn] r6107: nemerle/trunk/ncc/completion/CodeCompletionEngine.n

trupill svnadmin at nemerle.org
Sat Feb 4 13:27:07 CET 2006


Log:
Adding locking to completion engine. MonoDevelop crashes if not locking 
on it, because multiple Engines try to access the parser and typer.


Author: trupill
Date: Sat Feb  4 13:27:06 2006
New Revision: 6107

Modified:
   nemerle/trunk/ncc/completion/CodeCompletionEngine.n

Modified: nemerle/trunk/ncc/completion/CodeCompletionEngine.n
==============================================================================
--- nemerle/trunk/ncc/completion/CodeCompletionEngine.n	(original)
+++ nemerle/trunk/ncc/completion/CodeCompletionEngine.n	Sat Feb  4 13:27:06 2006
@@ -182,6 +182,8 @@
         public mutable References : ReferenceCollection;
         public Sources : SourceCollection;
         
+        static syncObject : object;
+
         internal set_unparsed_state () : void
         {
             Sources.set_unparsed_state ();
@@ -190,6 +192,7 @@
         public static this()
         {
             IsInCompletionMode = false;
+            syncObject = object();
         }
         
         public this()
@@ -259,6 +262,8 @@
         
         public RunCompletionEngine () : array[CompletionInfo]
         {
+            lock (syncObject)
+            {
             // Tell the methods we are in completion mode
             IsInCompletionMode = true;
             
@@ -447,6 +452,7 @@
             IsInCompletionMode = false;
             completionList.ToArray();
         }
+        }
         
         mutable listMessages : list[CompilerMessage];
         process_error_message (location : Location, message : string) : void
@@ -649,6 +655,8 @@
         
         public GetTypeTree () : TypeTree
         {
+            lock (syncObject)
+            {
             mutable tree = TypeTree ();
             
             Init ();
@@ -729,6 +737,7 @@
             
             tree
          }
+         }
          
          loop (x : NamespaceTree.Node) : void
          {



More information about the svn mailing list