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) });
|
panel.ShowErrors(new List<CompilerError> { new CompilerError(parser.ErrorDescription, parser.ErrorSource, parser.ErrorLine) });
|
||||||
}
|
}
|
||||||
|
|
||||||
parser.Dispose();
|
|
||||||
}
|
}
|
||||||
|
|
||||||
//mxd
|
//mxd
|
||||||
|
@ -360,8 +358,6 @@ namespace CodeImp.DoomBuilder.Controls
|
||||||
{
|
{
|
||||||
panel.ShowErrors(new List<CompilerError> { new CompilerError(parser.ErrorDescription, parser.ErrorSource, parser.ErrorLine) });
|
panel.ShowErrors(new List<CompilerError> { new CompilerError(parser.ErrorDescription, parser.ErrorSource, parser.ErrorLine) });
|
||||||
}
|
}
|
||||||
|
|
||||||
parser.Dispose();
|
|
||||||
}
|
}
|
||||||
|
|
||||||
//mxd
|
//mxd
|
||||||
|
@ -382,8 +378,6 @@ namespace CodeImp.DoomBuilder.Controls
|
||||||
{
|
{
|
||||||
panel.ShowErrors(new List<CompilerError> { new CompilerError(parser.ErrorDescription, parser.ErrorSource, parser.ErrorLine) });
|
panel.ShowErrors(new List<CompilerError> { new CompilerError(parser.ErrorDescription, parser.ErrorSource, parser.ErrorLine) });
|
||||||
}
|
}
|
||||||
|
|
||||||
parser.Dispose();
|
|
||||||
}
|
}
|
||||||
|
|
||||||
//mxd
|
//mxd
|
||||||
|
@ -401,7 +395,6 @@ namespace CodeImp.DoomBuilder.Controls
|
||||||
panel.ShowErrors(new List<CompilerError> { new CompilerError(parser.ErrorDescription, parser.ErrorSource, parser.ErrorLine) });
|
panel.ShowErrors(new List<CompilerError> { new CompilerError(parser.ErrorDescription, parser.ErrorSource, parser.ErrorLine) });
|
||||||
}
|
}
|
||||||
|
|
||||||
parser.Dispose();
|
|
||||||
return ScriptType.UNKNOWN;
|
return ScriptType.UNKNOWN;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
@ -256,7 +256,6 @@ namespace CodeImp.DoomBuilder.Controls
|
||||||
|
|
||||||
// Dispose compiler
|
// Dispose compiler
|
||||||
compiler.Dispose();
|
compiler.Dispose();
|
||||||
parser.Dispose();
|
|
||||||
|
|
||||||
// Update script navigator
|
// Update script navigator
|
||||||
UpdateNavigator();
|
UpdateNavigator();
|
||||||
|
|
|
@ -1925,7 +1925,6 @@ namespace CodeImp.DoomBuilder.Data
|
||||||
}
|
}
|
||||||
|
|
||||||
currentreader = null;
|
currentreader = null;
|
||||||
parser.Dispose();
|
|
||||||
|
|
||||||
foreach(KeyValuePair<string, ModelData> e in modeldefentriesbyname)
|
foreach(KeyValuePair<string, ModelData> e in modeldefentriesbyname)
|
||||||
{
|
{
|
||||||
|
@ -2013,7 +2012,6 @@ namespace CodeImp.DoomBuilder.Data
|
||||||
}
|
}
|
||||||
|
|
||||||
currentreader = null;
|
currentreader = null;
|
||||||
parser.Dispose();
|
|
||||||
|
|
||||||
//get voxel models
|
//get voxel models
|
||||||
foreach(KeyValuePair<string, bool> group in voxelNames)
|
foreach(KeyValuePair<string, bool> group in voxelNames)
|
||||||
|
@ -2076,8 +2074,6 @@ namespace CodeImp.DoomBuilder.Data
|
||||||
|
|
||||||
// And skyboxes
|
// And skyboxes
|
||||||
skyboxes = parser.Skyboxes;
|
skyboxes = parser.Skyboxes;
|
||||||
|
|
||||||
parser.Dispose();
|
|
||||||
}
|
}
|
||||||
|
|
||||||
//mxd. This updates mapinfo class only
|
//mxd. This updates mapinfo class only
|
||||||
|
@ -2128,7 +2124,6 @@ namespace CodeImp.DoomBuilder.Data
|
||||||
}
|
}
|
||||||
|
|
||||||
currentreader = null;
|
currentreader = null;
|
||||||
parser.Dispose();
|
|
||||||
}
|
}
|
||||||
|
|
||||||
private void ParseFromLocation(ZDTextParser parser, string location, bool clearerrors)
|
private void ParseFromLocation(ZDTextParser parser, string location, bool clearerrors)
|
||||||
|
@ -2162,7 +2157,6 @@ namespace CodeImp.DoomBuilder.Data
|
||||||
|
|
||||||
currentreader = null;
|
currentreader = null;
|
||||||
reverbs = parser.GetReverbs();
|
reverbs = parser.GetReverbs();
|
||||||
parser.Dispose();
|
|
||||||
}
|
}
|
||||||
|
|
||||||
//mxd. This loads SNDSEQ
|
//mxd. This loads SNDSEQ
|
||||||
|
@ -2191,7 +2185,6 @@ namespace CodeImp.DoomBuilder.Data
|
||||||
|
|
||||||
currentreader = null;
|
currentreader = null;
|
||||||
soundsequences = parser.GetSoundSequences();
|
soundsequences = parser.GetSoundSequences();
|
||||||
parser.Dispose();
|
|
||||||
}
|
}
|
||||||
|
|
||||||
//mxd. This loads cameratextures from ANIMDEFS
|
//mxd. This loads cameratextures from ANIMDEFS
|
||||||
|
@ -2259,7 +2252,6 @@ namespace CodeImp.DoomBuilder.Data
|
||||||
}
|
}
|
||||||
|
|
||||||
currentreader = null;
|
currentreader = null;
|
||||||
parser.Dispose();
|
|
||||||
}
|
}
|
||||||
|
|
||||||
//mxd
|
//mxd
|
||||||
|
|
|
@ -410,8 +410,6 @@ namespace CodeImp.DoomBuilder.Data
|
||||||
ImageData img = t.MakeImage();
|
ImageData img = t.MakeImage();
|
||||||
images.Add(img);
|
images.Add(img);
|
||||||
}
|
}
|
||||||
|
|
||||||
parser.Dispose();
|
|
||||||
}
|
}
|
||||||
|
|
||||||
// This loads a set of textures
|
// This loads a set of textures
|
||||||
|
@ -642,8 +640,6 @@ namespace CodeImp.DoomBuilder.Data
|
||||||
ImageData img = t.MakeImage();
|
ImageData img = t.MakeImage();
|
||||||
images.Add(img);
|
images.Add(img);
|
||||||
}
|
}
|
||||||
|
|
||||||
parser.Dispose();
|
|
||||||
}
|
}
|
||||||
|
|
||||||
// This finds and returns a patch stream
|
// This finds and returns a patch stream
|
||||||
|
@ -706,8 +702,6 @@ namespace CodeImp.DoomBuilder.Data
|
||||||
ImageData img = t.MakeImage();
|
ImageData img = t.MakeImage();
|
||||||
images.Add(img);
|
images.Add(img);
|
||||||
}
|
}
|
||||||
|
|
||||||
parser.Dispose();
|
|
||||||
}
|
}
|
||||||
|
|
||||||
// This finds and returns a sprite stream
|
// This finds and returns a sprite stream
|
||||||
|
|
|
@ -2136,8 +2136,6 @@ namespace CodeImp.DoomBuilder
|
||||||
compilererrors.Add(new CompilerError(parser.ErrorDescription, parser.ErrorSource, parser.ErrorLine));
|
compilererrors.Add(new CompilerError(parser.ErrorDescription, parser.ErrorSource, parser.ErrorLine));
|
||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
|
|
||||||
parser.Dispose();
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
|
@ -49,6 +49,9 @@ namespace CodeImp.DoomBuilder.ZDoom
|
||||||
|
|
||||||
//mxd. Includes tracking
|
//mxd. Includes tracking
|
||||||
private readonly HashSet<string> parsedlumps;
|
private readonly HashSet<string> parsedlumps;
|
||||||
|
|
||||||
|
//mxd. Disposing. Is that really needed?..
|
||||||
|
private bool isdisposed;
|
||||||
|
|
||||||
#endregion
|
#endregion
|
||||||
|
|
||||||
|
@ -57,7 +60,7 @@ namespace CodeImp.DoomBuilder.ZDoom
|
||||||
/// <summary>
|
/// <summary>
|
||||||
/// All actors that are supported by the current game.
|
/// All actors that are supported by the current game.
|
||||||
/// </summary>
|
/// </summary>
|
||||||
public ICollection<ActorStructure> Actors { get { return actors.Values; } }
|
public IEnumerable<ActorStructure> Actors { get { return actors.Values; } }
|
||||||
|
|
||||||
/// <summary>
|
/// <summary>
|
||||||
/// All actors defined in the loaded DECORATE structures. This includes actors not supported in the current game.
|
/// 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
|
// Disposer
|
||||||
override public void Dispose()
|
public void Dispose()
|
||||||
{
|
{
|
||||||
// Not already disposed?
|
//mxd. Not already disposed?
|
||||||
if(!isdisposed)
|
if(!isdisposed)
|
||||||
{
|
{
|
||||||
foreach(KeyValuePair<string, ActorStructure> a in archivedactors)
|
foreach(KeyValuePair<string, ActorStructure> a in archivedactors)
|
||||||
|
@ -103,7 +106,7 @@ namespace CodeImp.DoomBuilder.ZDoom
|
||||||
actors = null;
|
actors = null;
|
||||||
archivedactors = null;
|
archivedactors = null;
|
||||||
|
|
||||||
base.Dispose();
|
isdisposed = true;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
@ -28,7 +28,7 @@ using CodeImp.DoomBuilder.Data;
|
||||||
|
|
||||||
namespace CodeImp.DoomBuilder.ZDoom
|
namespace CodeImp.DoomBuilder.ZDoom
|
||||||
{
|
{
|
||||||
public abstract class ZDTextParser : IDisposable
|
public abstract class ZDTextParser
|
||||||
{
|
{
|
||||||
#region ================== Constants
|
#region ================== Constants
|
||||||
|
|
||||||
|
@ -55,9 +55,6 @@ namespace CodeImp.DoomBuilder.ZDoom
|
||||||
private string errordesc;
|
private string errordesc;
|
||||||
private string errorsource;
|
private string errorsource;
|
||||||
private long prevstreamposition; //mxd. Text stream position storted before performing ReadToken.
|
private long prevstreamposition; //mxd. Text stream position storted before performing ReadToken.
|
||||||
|
|
||||||
//mxd. Disposing
|
|
||||||
protected bool isdisposed;
|
|
||||||
|
|
||||||
#endregion
|
#endregion
|
||||||
|
|
||||||
|
@ -80,23 +77,6 @@ namespace CodeImp.DoomBuilder.ZDoom
|
||||||
// Initialize
|
// Initialize
|
||||||
errordesc = null;
|
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
|
#endregion
|
||||||
|
|
||||||
|
|
Loading…
Reference in a new issue