- Fixes ConcreteHistory::clear() not resetting history front. Prevent throwing of std::out_of_range when opening a file after having run the simulation.

git-svn-id: svn://svn.gna.org/svn/sgpemv2/trunk@1105 3ecf2c5c-341e-0410-92b4-d18e462d057c
This commit is contained in:
tchernobog 2006-09-12 09:27:35 +00:00
parent 0b8d42c933
commit 1d7c053012
1 changed files with 3 additions and 5 deletions

View File

@ -293,11 +293,10 @@ ConcreteHistory::remove(SubRequest& subrequest)
void
ConcreteHistory::clear()
{
for_each(_snapshots.begin(), _snapshots.end(),
deletor<ConcreteEnvironment>());
_snapshots.clear();
_snapshots.push_back(new ConcreteEnvironment());
reset(false);
assert(_snapshots.size() == 1);
delete _snapshots.front();
_snapshots.front() = new ConcreteEnvironment();
notify_change();
}
@ -400,7 +399,6 @@ ConcreteHistory::add_thread(const Glib::ustring& name,
{
reset(false);
// Holy cow! *THIS* is ugly!!!!
DynamicProcess& parent_process = dynamic_cast<DynamicProcess&>(parent);
StaticProcess& parent_core = parent_process.get_core();
StaticThread* core = new StaticThread(name, parent_core, cpu_time, arrival_time, base_priority);