Make sure Enumerator resources get cleaned up.
This commit is contained in:
parent
be989a233d
commit
6fd7d5dda5
|
@ -96,6 +96,7 @@ namespace IngameScript
|
|||
_program.Runtime.UpdateFrequency |= UpdateFrequency.Once;
|
||||
yield return true;
|
||||
}
|
||||
job.Dispose();
|
||||
|
||||
while (Triggered) yield return true;
|
||||
|
||||
|
|
|
@ -12,16 +12,16 @@ namespace IngameScript
|
|||
public class Sequencer
|
||||
{
|
||||
public bool Running { get; private set; }
|
||||
public string Name { get; private set; }
|
||||
|
||||
private IConsole _console;
|
||||
private string _name;
|
||||
|
||||
private SortedDictionary<int, List<ISequenceable>> _sequence = new SortedDictionary<int, List<ISequenceable>>();
|
||||
|
||||
public Sequencer(IConsoleProgram program, string name)
|
||||
{
|
||||
_name = name;
|
||||
_console = new PrefixedConsole(program.Console, _name);
|
||||
Name = name;
|
||||
_console = new PrefixedConsole(program.Console, Name);
|
||||
}
|
||||
|
||||
public void AddBlock(ISequenceable block)
|
||||
|
@ -66,6 +66,7 @@ namespace IngameScript
|
|||
}
|
||||
yield return true;
|
||||
}
|
||||
foreach (IEnumerator<bool> subJob in subJobs) subJob.Dispose(); // clean up after ourselves
|
||||
}
|
||||
}
|
||||
}
|
||||
|
|
Loading…
Reference in New Issue
Block a user