Reset the container after deleting all the elements.
authorZack Rusin <zack@kde.org>
Sat, 27 Aug 2011 22:49:35 +0000 (18:49 -0400)
committerZack Rusin <zack@kde.org>
Sat, 27 Aug 2011 22:49:35 +0000 (18:49 -0400)
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.

trace_parser.cpp

index 47d5a7a..44d1786 100644 (file)
@@ -84,9 +84,10 @@ deleteAll(Iter begin, Iter end)
 
 template <typename Container>
 inline void
-deleteAll(const Container &c)
+deleteAll(Container &c)
 {
     deleteAll(c.begin(), c.end());
+    c.clear();
 }
 
 void Parser::close(void) {