model: bugfix - resize thrd_last_action when adding objects
authorBrian Norris <banorris@uci.edu>
Thu, 12 Jul 2012 18:05:20 +0000 (11:05 -0700)
committerBrian Norris <banorris@uci.edu>
Thu, 12 Jul 2012 18:05:20 +0000 (11:05 -0700)
Apparently, STL vectors don't resize automatically, nor do they warn or print
errors when you access them out-of-bounds...

model.cc

index e579105768b5eff8e84ae9f252b4605c058fbfa3..cde6213ada34c0b3c6a9a5328474ddcf9371a726 100644 (file)
--- a/model.cc
+++ b/model.cc
@@ -291,6 +291,8 @@ void ModelChecker::add_action_to_lists(ModelAction *act)
                vec->resize(next_thread_id);
        (*vec)[tid].push_back(act);
 
                vec->resize(next_thread_id);
        (*vec)[tid].push_back(act);
 
+       if ((int)thrd_last_action->size() <= tid)
+               thrd_last_action->resize(get_num_threads());
        (*thrd_last_action)[tid] = act;
 }
 
        (*thrd_last_action)[tid] = act;
 }