mirror of
https://github.com/monero-project/monero.git
synced 2025-05-06 13:45:00 -04:00
Fix an object lifetime bug in net load tests
The commands handler must not be destroyed before the config object, or we'll be accessing freed memory. An earlier attempt at using boost::shared_ptr to control object lifetime turned out to be very invasive, though would be a better solution in theory.
This commit is contained in:
parent
86e9de588c
commit
7dbf76d0da
10 changed files with 45 additions and 16 deletions
|
@ -43,6 +43,8 @@ namespace levin
|
|||
struct protocl_handler_config
|
||||
{
|
||||
levin_commands_handler<t_connection_context>* m_pcommands_handler;
|
||||
void (*m_pcommands_handler_destroy)(levin_commands_handler<t_connection_context>*);
|
||||
~protocl_handler_config() { if (m_pcommands_handler && m_pcommands_handler_destroy) (*m_pcommands_handler_destroy)(m_pcommands_handler); }
|
||||
};
|
||||
|
||||
template<class t_connection_context = net_utils::connection_context_base>
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue