sim: Fix as issue where exit events on instr queues are used after freed.
authorAli Saidi <Ali.Saidi@ARM.com>
Fri, 2 Nov 2012 16:32:00 +0000 (11:32 -0500)
committerAli Saidi <Ali.Saidi@ARM.com>
Fri, 2 Nov 2012 16:32:00 +0000 (11:32 -0500)
src/sim/eventq.cc
src/sim/sim_events.cc

index b389efcf2f972f7e5169ebeb24c1db6611aed4f1..b32b330e71995ba44f32097c34be5e9208108b1f 100644 (file)
@@ -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 {
index 725e7da9deb61fcd992de67b513f9cf71f6157b8..a77e8b103be0b89564474fe259ce92a4ffc61e06 100644 (file)
@@ -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