mirror of
https://git.do.srb2.org/STJr/UltimateZoneBuilder.git
synced 2025-01-18 22:41:46 +00:00
Fixed a crash when using "Open map in current WAD" action when trying to reload any ZDoom text lump (as it turned out, implementing IDisposable in ZDTextParser was not such a bright idea...).
This commit is contained in:
parent
a1f8507167
commit
acdcd81913
7 changed files with 8 additions and 49 deletions
|
@ -340,8 +340,6 @@ namespace CodeImp.DoomBuilder.Controls
|
|||
{
|
||||
panel.ShowErrors(new List<CompilerError> { new CompilerError(parser.ErrorDescription, parser.ErrorSource, parser.ErrorLine) });
|
||||
}
|
||||
|
||||
parser.Dispose();
|
||||
}
|
||||
|
||||
//mxd
|
||||
|
@ -360,8 +358,6 @@ namespace CodeImp.DoomBuilder.Controls
|
|||
{
|
||||
panel.ShowErrors(new List<CompilerError> { new CompilerError(parser.ErrorDescription, parser.ErrorSource, parser.ErrorLine) });
|
||||
}
|
||||
|
||||
parser.Dispose();
|
||||
}
|
||||
|
||||
//mxd
|
||||
|
@ -382,8 +378,6 @@ namespace CodeImp.DoomBuilder.Controls
|
|||
{
|
||||
panel.ShowErrors(new List<CompilerError> { new CompilerError(parser.ErrorDescription, parser.ErrorSource, parser.ErrorLine) });
|
||||
}
|
||||
|
||||
parser.Dispose();
|
||||
}
|
||||
|
||||
//mxd
|
||||
|
@ -401,7 +395,6 @@ namespace CodeImp.DoomBuilder.Controls
|
|||
panel.ShowErrors(new List<CompilerError> { new CompilerError(parser.ErrorDescription, parser.ErrorSource, parser.ErrorLine) });
|
||||
}
|
||||
|
||||
parser.Dispose();
|
||||
return ScriptType.UNKNOWN;
|
||||
}
|
||||
|
||||
|
|
|
@ -256,7 +256,6 @@ namespace CodeImp.DoomBuilder.Controls
|
|||
|
||||
// Dispose compiler
|
||||
compiler.Dispose();
|
||||
parser.Dispose();
|
||||
|
||||
// Update script navigator
|
||||
UpdateNavigator();
|
||||
|
|
|
@ -1925,7 +1925,6 @@ namespace CodeImp.DoomBuilder.Data
|
|||
}
|
||||
|
||||
currentreader = null;
|
||||
parser.Dispose();
|
||||
|
||||
foreach(KeyValuePair<string, ModelData> e in modeldefentriesbyname)
|
||||
{
|
||||
|
@ -2013,7 +2012,6 @@ namespace CodeImp.DoomBuilder.Data
|
|||
}
|
||||
|
||||
currentreader = null;
|
||||
parser.Dispose();
|
||||
|
||||
//get voxel models
|
||||
foreach(KeyValuePair<string, bool> 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
|
||||
|
|
|
@ -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
|
||||
|
|
|
@ -2136,8 +2136,6 @@ namespace CodeImp.DoomBuilder
|
|||
compilererrors.Add(new CompilerError(parser.ErrorDescription, parser.ErrorSource, parser.ErrorLine));
|
||||
break;
|
||||
}
|
||||
|
||||
parser.Dispose();
|
||||
}
|
||||
}
|
||||
}
|
||||
|
|
|
@ -50,6 +50,9 @@ namespace CodeImp.DoomBuilder.ZDoom
|
|||
//mxd. Includes tracking
|
||||
private readonly HashSet<string> parsedlumps;
|
||||
|
||||
//mxd. Disposing. Is that really needed?..
|
||||
private bool isdisposed;
|
||||
|
||||
#endregion
|
||||
|
||||
#region ================== Properties
|
||||
|
@ -57,7 +60,7 @@ namespace CodeImp.DoomBuilder.ZDoom
|
|||
/// <summary>
|
||||
/// All actors that are supported by the current game.
|
||||
/// </summary>
|
||||
public ICollection<ActorStructure> Actors { get { return actors.Values; } }
|
||||
public IEnumerable<ActorStructure> Actors { get { return actors.Values; } }
|
||||
|
||||
/// <summary>
|
||||
/// 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<string, ActorStructure> a in archivedactors)
|
||||
|
@ -103,7 +106,7 @@ namespace CodeImp.DoomBuilder.ZDoom
|
|||
actors = null;
|
||||
archivedactors = null;
|
||||
|
||||
base.Dispose();
|
||||
isdisposed = true;
|
||||
}
|
||||
}
|
||||
|
||||
|
|
|
@ -28,7 +28,7 @@ using CodeImp.DoomBuilder.Data;
|
|||
|
||||
namespace CodeImp.DoomBuilder.ZDoom
|
||||
{
|
||||
public abstract class ZDTextParser : IDisposable
|
||||
public abstract class ZDTextParser
|
||||
{
|
||||
#region ================== Constants
|
||||
|
||||
|
@ -56,9 +56,6 @@ namespace CodeImp.DoomBuilder.ZDoom
|
|||
private string errorsource;
|
||||
private long prevstreamposition; //mxd. Text stream position storted before performing ReadToken.
|
||||
|
||||
//mxd. Disposing
|
||||
protected bool isdisposed;
|
||||
|
||||
#endregion
|
||||
|
||||
#region ================== Properties
|
||||
|
@ -81,23 +78,6 @@ namespace CodeImp.DoomBuilder.ZDoom
|
|||
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
|
||||
|
||||
#region ================== Parsing
|
||||
|
|
Loading…
Reference in a new issue