diff --git a/Source/Core/Controls/ScriptDocumentTab.cs b/Source/Core/Controls/ScriptDocumentTab.cs index 25b83aa9..bd7b5daf 100644 --- a/Source/Core/Controls/ScriptDocumentTab.cs +++ b/Source/Core/Controls/ScriptDocumentTab.cs @@ -340,8 +340,6 @@ namespace CodeImp.DoomBuilder.Controls { panel.ShowErrors(new List { new CompilerError(parser.ErrorDescription, parser.ErrorSource, parser.ErrorLine) }); } - - parser.Dispose(); } //mxd @@ -360,8 +358,6 @@ namespace CodeImp.DoomBuilder.Controls { panel.ShowErrors(new List { new CompilerError(parser.ErrorDescription, parser.ErrorSource, parser.ErrorLine) }); } - - parser.Dispose(); } //mxd @@ -382,8 +378,6 @@ namespace CodeImp.DoomBuilder.Controls { panel.ShowErrors(new List { new CompilerError(parser.ErrorDescription, parser.ErrorSource, parser.ErrorLine) }); } - - parser.Dispose(); } //mxd @@ -401,7 +395,6 @@ namespace CodeImp.DoomBuilder.Controls panel.ShowErrors(new List { new CompilerError(parser.ErrorDescription, parser.ErrorSource, parser.ErrorLine) }); } - parser.Dispose(); return ScriptType.UNKNOWN; } diff --git a/Source/Core/Controls/ScriptFileDocumentTab.cs b/Source/Core/Controls/ScriptFileDocumentTab.cs index 10d614ae..698ce69f 100644 --- a/Source/Core/Controls/ScriptFileDocumentTab.cs +++ b/Source/Core/Controls/ScriptFileDocumentTab.cs @@ -256,7 +256,6 @@ namespace CodeImp.DoomBuilder.Controls // Dispose compiler compiler.Dispose(); - parser.Dispose(); // Update script navigator UpdateNavigator(); diff --git a/Source/Core/Data/DataManager.cs b/Source/Core/Data/DataManager.cs index ec7d50ff..aea54818 100644 --- a/Source/Core/Data/DataManager.cs +++ b/Source/Core/Data/DataManager.cs @@ -1925,7 +1925,6 @@ namespace CodeImp.DoomBuilder.Data } currentreader = null; - parser.Dispose(); foreach(KeyValuePair e in modeldefentriesbyname) { @@ -2013,7 +2012,6 @@ namespace CodeImp.DoomBuilder.Data } currentreader = null; - parser.Dispose(); //get voxel models foreach(KeyValuePair group in voxelNames) @@ -2076,8 +2074,6 @@ namespace CodeImp.DoomBuilder.Data // And skyboxes skyboxes = parser.Skyboxes; - - parser.Dispose(); } //mxd. This updates mapinfo class only @@ -2128,7 +2124,6 @@ namespace CodeImp.DoomBuilder.Data } currentreader = null; - parser.Dispose(); } private void ParseFromLocation(ZDTextParser parser, string location, bool clearerrors) @@ -2162,7 +2157,6 @@ namespace CodeImp.DoomBuilder.Data currentreader = null; reverbs = parser.GetReverbs(); - parser.Dispose(); } //mxd. This loads SNDSEQ @@ -2191,7 +2185,6 @@ namespace CodeImp.DoomBuilder.Data currentreader = null; soundsequences = parser.GetSoundSequences(); - parser.Dispose(); } //mxd. This loads cameratextures from ANIMDEFS @@ -2259,7 +2252,6 @@ namespace CodeImp.DoomBuilder.Data } currentreader = null; - parser.Dispose(); } //mxd diff --git a/Source/Core/Data/WADReader.cs b/Source/Core/Data/WADReader.cs index a5134a8e..da9cdc12 100644 --- a/Source/Core/Data/WADReader.cs +++ b/Source/Core/Data/WADReader.cs @@ -410,8 +410,6 @@ namespace CodeImp.DoomBuilder.Data ImageData img = t.MakeImage(); images.Add(img); } - - parser.Dispose(); } // This loads a set of textures @@ -642,8 +640,6 @@ namespace CodeImp.DoomBuilder.Data ImageData img = t.MakeImage(); images.Add(img); } - - parser.Dispose(); } // This finds and returns a patch stream @@ -706,8 +702,6 @@ namespace CodeImp.DoomBuilder.Data ImageData img = t.MakeImage(); images.Add(img); } - - parser.Dispose(); } // This finds and returns a sprite stream diff --git a/Source/Core/General/MapManager.cs b/Source/Core/General/MapManager.cs index 4d79851c..7a6db894 100644 --- a/Source/Core/General/MapManager.cs +++ b/Source/Core/General/MapManager.cs @@ -2136,8 +2136,6 @@ namespace CodeImp.DoomBuilder compilererrors.Add(new CompilerError(parser.ErrorDescription, parser.ErrorSource, parser.ErrorLine)); break; } - - parser.Dispose(); } } } diff --git a/Source/Core/ZDoom/DecorateParser.cs b/Source/Core/ZDoom/DecorateParser.cs index 9e0d04de..c775ce86 100644 --- a/Source/Core/ZDoom/DecorateParser.cs +++ b/Source/Core/ZDoom/DecorateParser.cs @@ -49,6 +49,9 @@ namespace CodeImp.DoomBuilder.ZDoom //mxd. Includes tracking private readonly HashSet parsedlumps; + + //mxd. Disposing. Is that really needed?.. + private bool isdisposed; #endregion @@ -57,7 +60,7 @@ namespace CodeImp.DoomBuilder.ZDoom /// /// All actors that are supported by the current game. /// - public ICollection Actors { get { return actors.Values; } } + public IEnumerable Actors { get { return actors.Values; } } /// /// All actors defined in the loaded DECORATE structures. This includes actors not supported in the current game. @@ -92,9 +95,9 @@ namespace CodeImp.DoomBuilder.ZDoom } // Disposer - override public void Dispose() + public void Dispose() { - // Not already disposed? + //mxd. Not already disposed? if(!isdisposed) { foreach(KeyValuePair a in archivedactors) @@ -103,7 +106,7 @@ namespace CodeImp.DoomBuilder.ZDoom actors = null; archivedactors = null; - base.Dispose(); + isdisposed = true; } } diff --git a/Source/Core/ZDoom/ZDTextParser.cs b/Source/Core/ZDoom/ZDTextParser.cs index 715c7568..cb5c3821 100644 --- a/Source/Core/ZDoom/ZDTextParser.cs +++ b/Source/Core/ZDoom/ZDTextParser.cs @@ -28,7 +28,7 @@ using CodeImp.DoomBuilder.Data; namespace CodeImp.DoomBuilder.ZDoom { - public abstract class ZDTextParser : IDisposable + public abstract class ZDTextParser { #region ================== Constants @@ -55,9 +55,6 @@ namespace CodeImp.DoomBuilder.ZDoom private string errordesc; private string errorsource; private long prevstreamposition; //mxd. Text stream position storted before performing ReadToken. - - //mxd. Disposing - protected bool isdisposed; #endregion @@ -80,23 +77,6 @@ namespace CodeImp.DoomBuilder.ZDoom // Initialize errordesc = null; } - - //mxd - public virtual void Dispose() - { - // Not already disposed? - if(!isdisposed) - { - if(datareader != null) datareader.Close(); - if(datastream != null) - { - datastream.Dispose(); - datastream = null; - } - - isdisposed = true; - } - } #endregion