rosbag: clear Bag member variables on close

This commit is contained in:
Tim Field 2010-07-14 22:50:01 +00:00
parent d9413dd62f
commit 740bff1323
1 changed files with 9 additions and 4 deletions

View File

@ -84,9 +84,6 @@ Bag::Bag(string const& filename, uint32_t mode) :
Bag::~Bag() {
close();
for (map<uint32_t, ConnectionInfo*>::iterator i = connections_.begin(); i != connections_.end(); i++)
delete i->second;
}
void Bag::open(string const& filename, uint32_t mode) {
@ -108,7 +105,6 @@ void Bag::open(string const& filename, uint32_t mode) {
seek(offset);
}
void Bag::openRead(string const& filename) {
file_.openRead(filename);
@ -158,6 +154,15 @@ void Bag::close() {
closeWrite();
file_.close();
topic_connection_ids_.clear();
header_connection_ids_.clear();
for (map<uint32_t, ConnectionInfo*>::iterator i = connections_.begin(); i != connections_.end(); i++)
delete i->second;
connections_.clear();
chunks_.clear();
connection_indexes_.clear();
curr_chunk_connection_indexes_.clear();
}
void Bag::closeWrite() {