From: Zack Rusin Date: Sat, 27 Aug 2011 22:49:35 +0000 (-0400) Subject: Reset the container after deleting all the elements. X-Git-Url: https://git.cworth.org/git?a=commitdiff_plain;h=03718f44e002669e8b94561d95ad00bd1a51a1ef;p=apitrace Reset the container after deleting all the elements. otherwise the size of the containers stays the same but the elements hold references to items that have been deleted. It causes crashes if close is called more than once. --- diff --git a/trace_parser.cpp b/trace_parser.cpp index 47d5a7a..44d1786 100644 --- a/trace_parser.cpp +++ b/trace_parser.cpp @@ -84,9 +84,10 @@ deleteAll(Iter begin, Iter end) template inline void -deleteAll(const Container &c) +deleteAll(Container &c) { deleteAll(c.begin(), c.end()); + c.clear(); } void Parser::close(void) {