db_lmdb: safety close db at exit

Noticed by hyc

Also set m_open to false when closed
This commit is contained in:
moneromooo-monero 2015-12-28 19:23:02 +00:00
parent 45800a25e9
commit 78b65cf7e8
No known key found for this signature in database
GPG Key ID: 686F07454D6CEFC3
1 changed files with 3 additions and 0 deletions

View File

@ -926,6 +926,8 @@ BlockchainLMDB::~BlockchainLMDB()
// batch transaction shouldn't be active at this point. If it is, consider it aborted.
if (m_batch_active)
batch_abort();
if (m_open)
close();
}
BlockchainLMDB::BlockchainLMDB(bool batch_transactions)
@ -1156,6 +1158,7 @@ void BlockchainLMDB::close()
// FIXME: not yet thread safe!!! Use with care.
mdb_env_close(m_env);
m_open = false;
}
void BlockchainLMDB::sync()