Răsfoiți Sursa

Merge branch 'master' into develop

Xanathar 9 ani în urmă
părinte
comite
05d01ea2ea

+ 2 - 1
src/MoonSharp.Interpreter/DataStructs/LinkedListIndex.cs

@@ -113,7 +113,8 @@ namespace MoonSharp.Interpreter.DataStructs
 		/// </summary>
 		public void Clear()
 		{
-			m_Map.Clear();
+            if(m_Map != null)
+			    m_Map.Clear();
 		}
 	}
 }

+ 1 - 0
src/MoonSharp.Interpreter/DataTypes/Table.cs

@@ -63,6 +63,7 @@ namespace MoonSharp.Interpreter
 			m_StringMap.Clear();
 			m_ArrayMap.Clear();
 			m_ValueMap.Clear();
+            m_CachedLength = -1;
 		}
 
 		/// <summary>

+ 7 - 2
src/MoonSharp.RemoteDebugger/DebugServer.cs

@@ -12,7 +12,7 @@ using MoonSharp.RemoteDebugger.Threading;
 
 namespace MoonSharp.RemoteDebugger
 {
-	public class DebugServer : IDebugger
+	public class DebugServer : IDebugger, IDisposable
 	{
 		List<DynamicExpression> m_Watches = new List<DynamicExpression>();
 		HashSet<string> m_WatchesChanging = new HashSet<string>();
@@ -452,5 +452,10 @@ namespace MoonSharp.RemoteDebugger
 			m_RequestPause = m_ErrorRegEx.IsMatch(ex.Message);
 			return IsPauseRequested();
 		}
-	}
+
+        public void Dispose()
+        {
+            m_Server.Dispose();
+        }
+    }
 }

+ 6 - 4
src/MoonSharp.RemoteDebugger/Network/HttpServer.cs

@@ -14,7 +14,7 @@ namespace MoonSharp.RemoteDebugger.Network
 	/// excalated. This just uses a TcpListener and a Socket.
 	/// This supports only GET method and basic (or no) authentication.
 	/// </summary>
-	public class HttpServer
+	public class HttpServer : IDisposable
 	{
 		Utf8TcpServer m_Server;
 		Dictionary<string, List<string>> m_HttpData = new Dictionary<string, List<string>>();
@@ -252,7 +252,9 @@ namespace MoonSharp.RemoteDebugger.Network
 			m_Resources.Add(path, resource);
 		}
 
-
-
-	}
+        public void Dispose()
+        {
+            m_Server.Dispose();
+        }
+    }
 }

+ 8 - 8
src/MoonSharp.RemoteDebugger/RemoteDebugger.cs

@@ -7,7 +7,7 @@ using MoonSharp.RemoteDebugger.Network;
 
 namespace MoonSharp.RemoteDebugger
 {
-	public class RemoteDebuggerService
+	public class RemoteDebuggerService : IDisposable
 	{
 		RemoteDebuggerOptions m_Options;
 		DebugWebHost m_HttpServer;
@@ -82,7 +82,13 @@ namespace MoonSharp.RemoteDebugger
 			return sb.ToString();
 		}
 
-		public string HttpUrlStringLocalHost
+        public void Dispose()
+        {
+            m_HttpServer.Dispose();
+            m_DebugServers.ForEach(s => s.Dispose());
+        }
+
+        public string HttpUrlStringLocalHost
 		{
 			get
 			{
@@ -93,11 +99,5 @@ namespace MoonSharp.RemoteDebugger
 				return null;
 			}
 		}
-
-
-
-
-
-
 	}
 }