mirror of
https://github.com/dashpay/dash.git
synced 2024-12-26 12:32:48 +01:00
merge bitcoin#18615: Avoid accessing free'd memory in validation_chainstatemanager_tests
This commit is contained in:
parent
35ee0b4b89
commit
c1ed4cbdae
@ -70,12 +70,8 @@ BOOST_FIXTURE_TEST_CASE(txindex_initial_sync, TestChain100Setup)
|
|||||||
// shutdown sequence (c.f. Shutdown() in init.cpp)
|
// shutdown sequence (c.f. Shutdown() in init.cpp)
|
||||||
txindex.Stop();
|
txindex.Stop();
|
||||||
|
|
||||||
// txindex job may be scheduled, so stop scheduler before destructing
|
// Let scheduler events finish running to avoid accessing any memory related to txindex after it is destructed
|
||||||
m_node.scheduler->stop();
|
SyncWithValidationInterfaceQueue();
|
||||||
threadGroup.interrupt_all();
|
|
||||||
threadGroup.join_all();
|
|
||||||
|
|
||||||
// Rest of shutdown sequence and destructors happen in ~TestingSetup()
|
|
||||||
}
|
}
|
||||||
|
|
||||||
BOOST_AUTO_TEST_SUITE_END()
|
BOOST_AUTO_TEST_SUITE_END()
|
||||||
|
@ -3,13 +3,14 @@
|
|||||||
// file COPYING or http://www.opensource.org/licenses/mit-license.php.
|
// file COPYING or http://www.opensource.org/licenses/mit-license.php.
|
||||||
//
|
//
|
||||||
#include <chainparams.h>
|
#include <chainparams.h>
|
||||||
#include <random.h>
|
|
||||||
#include <index/txindex.h>
|
#include <index/txindex.h>
|
||||||
#include <uint256.h>
|
|
||||||
#include <consensus/validation.h>
|
#include <consensus/validation.h>
|
||||||
|
#include <random.h>
|
||||||
#include <sync.h>
|
#include <sync.h>
|
||||||
#include <test/util/setup_common.h>
|
#include <test/util/setup_common.h>
|
||||||
|
#include <uint256.h>
|
||||||
#include <validation.h>
|
#include <validation.h>
|
||||||
|
#include <validationinterface.h>
|
||||||
|
|
||||||
#include <vector>
|
#include <vector>
|
||||||
|
|
||||||
@ -102,7 +103,9 @@ BOOST_AUTO_TEST_CASE(chainstatemanager)
|
|||||||
exp_tip = c1.m_chain.Tip();
|
exp_tip = c1.m_chain.Tip();
|
||||||
BOOST_CHECK_EQUAL(validated_tip, exp_tip);
|
BOOST_CHECK_EQUAL(validated_tip, exp_tip);
|
||||||
|
|
||||||
// Avoid triggering the address sanitizer.
|
// Let scheduler events finish running to avoid accessing memory that is going to be unloaded
|
||||||
|
SyncWithValidationInterfaceQueue();
|
||||||
|
|
||||||
WITH_LOCK(::cs_main, manager.Unload());
|
WITH_LOCK(::cs_main, manager.Unload());
|
||||||
}
|
}
|
||||||
|
|
||||||
|
Loading…
Reference in New Issue
Block a user