From 0b78c1dafe247b0168036b3d4d562d772b5529bd Mon Sep 17 00:00:00 2001 From: arookas Date: Thu, 10 Dec 2015 17:53:00 -0500 Subject: [PATCH] Fixed: dispose the script streams once they exit. --- context.cs | 1 + import resolver.cs | 7 ++++++- 2 files changed, 7 insertions(+), 1 deletion(-) diff --git a/context.cs b/context.cs index f87c130..b8b8fde 100644 --- a/context.cs +++ b/context.cs @@ -93,6 +93,7 @@ namespace arookas var tree = parser.Parse(file); tree.Compile(this); ImportResolver.ExitFile(file); + file.Dispose(); } return result; } diff --git a/import resolver.cs b/import resolver.cs index 84be586..47a07d9 100644 --- a/import resolver.cs +++ b/import resolver.cs @@ -85,7 +85,7 @@ namespace arookas FailedToLoad, } - public class sunScriptFile + public class sunScriptFile : IDisposable { public string Name { get; private set; } public Stream Stream { get; private set; } @@ -108,6 +108,11 @@ namespace arookas Stream = stream; } + public void Dispose() + { + Stream.Dispose(); + } + public TextReader GetReader() { return new StreamReader(Stream);