From 84a0198ec9f6782a828e4a6b3c1df9838d577522 Mon Sep 17 00:00:00 2001 From: Kevin Heifner Date: Mon, 27 Jan 2020 08:27:44 -0600 Subject: [PATCH] Keep http_plugin_impl alive until all posted jobs finish --- plugins/http_plugin/http_plugin.cpp | 2 ++ plugins/http_plugin/include/eosio/http_plugin/http_plugin.hpp | 2 +- 2 files changed, 3 insertions(+), 1 deletion(-) diff --git a/plugins/http_plugin/http_plugin.cpp b/plugins/http_plugin/http_plugin.cpp index 7a720fa7564..887a2958c92 100644 --- a/plugins/http_plugin/http_plugin.cpp +++ b/plugins/http_plugin/http_plugin.cpp @@ -691,6 +691,8 @@ namespace eosio { if( my->thread_pool ) { my->thread_pool->stop(); } + + app().post( 0, [me = my](){} ); // keep my pointer alive until queue is drained } void http_plugin::add_handler(const string& url, const url_handler& handler) { diff --git a/plugins/http_plugin/include/eosio/http_plugin/http_plugin.hpp b/plugins/http_plugin/include/eosio/http_plugin/http_plugin.hpp index 5c81279fe62..29c31474fec 100644 --- a/plugins/http_plugin/include/eosio/http_plugin/http_plugin.hpp +++ b/plugins/http_plugin/include/eosio/http_plugin/http_plugin.hpp @@ -98,7 +98,7 @@ namespace eosio { get_supported_apis_result get_supported_apis()const; private: - std::unique_ptr my; + std::shared_ptr my; }; /**