From 78b65cf7e8089d370aa7e8b481ccce8a3b9cd4af Mon Sep 17 00:00:00 2001 From: moneromooo-monero Date: Mon, 28 Dec 2015 19:23:02 +0000 Subject: db_lmdb: safety close db at exit Noticed by hyc Also set m_open to false when closed --- src/blockchain_db/lmdb/db_lmdb.cpp | 3 +++ 1 file changed, 3 insertions(+) (limited to 'src') diff --git a/src/blockchain_db/lmdb/db_lmdb.cpp b/src/blockchain_db/lmdb/db_lmdb.cpp index ded648cae..85eaf4569 100644 --- a/src/blockchain_db/lmdb/db_lmdb.cpp +++ b/src/blockchain_db/lmdb/db_lmdb.cpp @@ -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() -- cgit v1.2.3