diff --git a/src/sim/eventq.cc b/src/sim/eventq.cc index b389efcf2..b32b330e7 100644 --- a/src/sim/eventq.cc +++ b/src/sim/eventq.cc @@ -203,7 +203,8 @@ EventQueue::serviceOne() if (!event->squashed()) { event->process(); if (event->isExitEvent()) { - assert(!event->flags.isSet(Event::AutoDelete)); // would be silly + assert(!event->flags.isSet(Event::AutoDelete) || + !event->flags.isSet(Event::IsMainQueue)); // would be silly return event; } } else { diff --git a/src/sim/sim_events.cc b/src/sim/sim_events.cc index 725e7da9d..a77e8b103 100644 --- a/src/sim/sim_events.cc +++ b/src/sim/sim_events.cc @@ -56,7 +56,7 @@ SimLoopExitEvent::process() // queue. if (!isFlagSet(IsMainQueue)) { exitSimLoop(cause, code); - delete this; + setFlags(AutoDelete); } // otherwise do nothing... the IsExitEvent flag takes care of