X-Git-Url: http://plrg.eecs.uci.edu/git/?a=blobdiff_plain;f=actionlist.cc;h=4a24ba9952a32bffbefdbdf418a031d6ac1db412;hb=1e3cce83f208da50a267c163841f12d491aeec86;hp=9f95384d1ac487d94906b99612a69c7e8eb8ba65;hpb=909fa209cb60fff5d6f72e5826eae13e6eca96de;p=c11tester.git diff --git a/actionlist.cc b/actionlist.cc index 9f95384d..4a24ba99 100644 --- a/actionlist.cc +++ b/actionlist.cc @@ -227,8 +227,7 @@ void actionlist::removeAction(ModelAction * act) { void actionlist::clear() { for(uint i = 0;i < ALLNODESIZE;i++) { if (root.children[i] != NULL) { - if (!(((uintptr_t) root.children[i]) & ISACT)) - delete root.children[i]; + delete root.children[i]; root.children[i] = NULL; } } @@ -247,3 +246,16 @@ void actionlist::clear() { bool actionlist::isEmpty() { return root.count == 0; } + +/** + * Fix the parent pointer of root when root address changes (possible + * due to vector resize) + */ +void actionlist::fixupParent() +{ + for (int i = 0; i < ALLNODESIZE; i++) { + allnode * child = root.children[i]; + if (child != NULL && child->parent != &root) + child->parent = &root; + } +}