diff --git a/src/simplewallet/simplewallet.cpp b/src/simplewallet/simplewallet.cpp index 8e798c08..45c77b65 100644 --- a/src/simplewallet/simplewallet.cpp +++ b/src/simplewallet/simplewallet.cpp @@ -229,7 +229,9 @@ simple_wallet::simple_wallet() } //---------------------------------------------------------------------------------------------------- - +simple_wallet::~simple_wallet() +{ +} bool simple_wallet::enable_concole_logger(const std::vector &args) { log_space::log_singletone::add_logger(LOGGER_CONSOLE, NULL, NULL, LOG_LEVEL_0); @@ -1517,14 +1519,13 @@ bool simple_wallet::submit_transfer(const std::vector &args) //---------------------------------------------------------------------------------------------------- int main(int argc, char* argv[]) { - try - { - TRY_ENTRY(); - #ifdef WIN32 - _CrtSetDbgFlag ( _CRTDBG_ALLOC_MEM_DF | _CRTDBG_LEAK_CHECK_DF ); + _CrtSetDbgFlag(_CRTDBG_ALLOC_MEM_DF | _CRTDBG_LEAK_CHECK_DF); + //_CrtSetBreakAlloc(9594); #endif + TRY_ENTRY(); + tools::signal_handler::install_fatal([](int sig_number, void* address) { std::cout << "\n\nFATAL ERROR\nsig: " << sig_number << ", address: " << address; // in case error happens before log init std::fflush(nullptr); // all open output streams are flushed @@ -1563,6 +1564,7 @@ int main(int argc, char* argv[]) positional_options.add(arg_command.name, -1); shared_ptr sw(new currency::simple_wallet); + po::options_description desc_all; desc_all.add(desc_general).add(desc_params); po::variables_map vm; @@ -1613,7 +1615,7 @@ int main(int argc, char* argv[]) bool offline_mode = command_line::get_arg(vm, arg_offline_mode); - if(command_line::has_arg(vm, tools::wallet_rpc_server::arg_rpc_bind_port)) + if (command_line::has_arg(vm, tools::wallet_rpc_server::arg_rpc_bind_port)) { // runs wallet as RPC server log_space::log_singletone::add_logger(LOGGER_CONSOLE, NULL, NULL, LOG_LEVEL_2); @@ -1647,8 +1649,8 @@ int main(int argc, char* argv[]) } } - std::string wallet_file = command_line::get_arg(vm, arg_wallet_file); - std::string daemon_address = command_line::get_arg(vm, arg_daemon_address); + std::string wallet_file = command_line::get_arg(vm, arg_wallet_file); + std::string daemon_address = command_line::get_arg(vm, arg_daemon_address); std::string daemon_host = command_line::get_arg(vm, arg_daemon_host); int daemon_port = command_line::get_arg(vm, arg_daemon_port); if (daemon_host.empty()) @@ -1751,11 +1753,6 @@ int main(int argc, char* argv[]) } } - CATCH_ENTRY_L0(__func__, EXIT_FAILURE); - } - catch (...) - { - return EXIT_FAILURE; - } + CATCH_ENTRY_L0(__func__, EXIT_FAILURE); return EXIT_SUCCESS; } diff --git a/src/simplewallet/simplewallet.h b/src/simplewallet/simplewallet.h index 2cb4b13b..34ba13b2 100644 --- a/src/simplewallet/simplewallet.h +++ b/src/simplewallet/simplewallet.h @@ -29,6 +29,7 @@ namespace currency typedef std::vector command_type; simple_wallet(); + ~simple_wallet(); bool init(const boost::program_options::variables_map& vm); bool deinit(); bool run(); diff --git a/src/wallet/wallet2.cpp b/src/wallet/wallet2.cpp index 90e6a4fa..caa2b0e7 100644 --- a/src/wallet/wallet2.cpp +++ b/src/wallet/wallet2.cpp @@ -1730,6 +1730,7 @@ void wallet2::detach_blockchain(uint64_t height) //---------------------------------------------------------------------------------------------------- bool wallet2::deinit() { + m_wcallback.reset(); return true; } //----------------------------------------------------------------------------------------------------