mirror of
https://github.com/monero-project/monero.git
synced 2026-01-22 04:22:55 +01:00
db_lmdb: safety close db at exit
Noticed by hyc Also set m_open to false when closed
This commit is contained in:
@@ -926,6 +926,8 @@ BlockchainLMDB::~BlockchainLMDB()
|
|||||||
// batch transaction shouldn't be active at this point. If it is, consider it aborted.
|
// batch transaction shouldn't be active at this point. If it is, consider it aborted.
|
||||||
if (m_batch_active)
|
if (m_batch_active)
|
||||||
batch_abort();
|
batch_abort();
|
||||||
|
if (m_open)
|
||||||
|
close();
|
||||||
}
|
}
|
||||||
|
|
||||||
BlockchainLMDB::BlockchainLMDB(bool batch_transactions)
|
BlockchainLMDB::BlockchainLMDB(bool batch_transactions)
|
||||||
@@ -1156,6 +1158,7 @@ void BlockchainLMDB::close()
|
|||||||
|
|
||||||
// FIXME: not yet thread safe!!! Use with care.
|
// FIXME: not yet thread safe!!! Use with care.
|
||||||
mdb_env_close(m_env);
|
mdb_env_close(m_env);
|
||||||
|
m_open = false;
|
||||||
}
|
}
|
||||||
|
|
||||||
void BlockchainLMDB::sync()
|
void BlockchainLMDB::sync()
|
||||||
|
|||||||
Reference in New Issue
Block a user