From d0678d1c31bbb0c08e58762a36d5d2382b0a537f Mon Sep 17 00:00:00 2001 From: Ali Saidi Date: Fri, 2 Nov 2012 11:32:00 -0500 Subject: [PATCH] sim: Fix as issue where exit events on instr queues are used after freed. --- src/sim/eventq.cc | 3 ++- src/sim/sim_events.cc | 2 +- 2 files changed, 3 insertions(+), 2 deletions(-) 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 -- 2.30.2