mirror of
https://git.wownero.com/wownero/wownero.git
synced 2024-08-15 01:03:23 +00:00
LMDB: protection against UB, by not calling virtual methods from destructor
This commit is contained in:
parent
8fde011dbe
commit
514f8fab14
1 changed files with 5 additions and 5 deletions
|
@ -1267,11 +1267,11 @@ 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)
|
||||||
{
|
{
|
||||||
try { batch_abort(); }
|
try { BlockchainLMDB::batch_abort(); }
|
||||||
catch (...) { /* ignore */ }
|
catch (...) { /* ignore */ }
|
||||||
}
|
}
|
||||||
if (m_open)
|
if (m_open)
|
||||||
close();
|
BlockchainLMDB::close();
|
||||||
}
|
}
|
||||||
|
|
||||||
BlockchainLMDB::BlockchainLMDB(bool batch_transactions): BlockchainDB()
|
BlockchainLMDB::BlockchainLMDB(bool batch_transactions): BlockchainDB()
|
||||||
|
@ -1569,9 +1569,9 @@ void BlockchainLMDB::close()
|
||||||
if (m_batch_active)
|
if (m_batch_active)
|
||||||
{
|
{
|
||||||
LOG_PRINT_L3("close() first calling batch_abort() due to active batch transaction");
|
LOG_PRINT_L3("close() first calling batch_abort() due to active batch transaction");
|
||||||
batch_abort();
|
BlockchainLMDB::batch_abort();
|
||||||
}
|
}
|
||||||
this->sync();
|
BlockchainLMDB::sync();
|
||||||
m_tinfo.reset();
|
m_tinfo.reset();
|
||||||
|
|
||||||
// FIXME: not yet thread safe!!! Use with care.
|
// FIXME: not yet thread safe!!! Use with care.
|
||||||
|
@ -1584,7 +1584,7 @@ void BlockchainLMDB::sync()
|
||||||
LOG_PRINT_L3("BlockchainLMDB::" << __func__);
|
LOG_PRINT_L3("BlockchainLMDB::" << __func__);
|
||||||
check_open();
|
check_open();
|
||||||
|
|
||||||
if (is_read_only())
|
if (BlockchainLMDB::is_read_only())
|
||||||
return;
|
return;
|
||||||
|
|
||||||
// Does nothing unless LMDB environment was opened with MDB_NOSYNC or in part
|
// Does nothing unless LMDB environment was opened with MDB_NOSYNC or in part
|
||||||
|
|
Loading…
Reference in a new issue