diff --git a/src/source_language_protocol.cc b/src/source_language_protocol.cc index 73c99a0..23b4257 100644 --- a/src/source_language_protocol.cc +++ b/src/source_language_protocol.cc @@ -154,10 +154,10 @@ void LanguageProtocol::Client::parse_server_message() { auto id_it=handlers.find(message_id); if(id_it!=handlers.end()) { auto function=std::move(id_it->second); + handlers.erase(id_it->first); lock.unlock(); function(result_it->second, false); lock.lock(); - handlers.erase(id_it->first); } } } @@ -168,10 +168,10 @@ void LanguageProtocol::Client::parse_server_message() { auto id_it=handlers.find(message_id); if(id_it!=handlers.end()) { auto function=std::move(id_it->second); + handlers.erase(id_it->first); lock.unlock(); function(result_it->second, true); lock.lock(); - handlers.erase(id_it->first); } } } @@ -221,10 +221,10 @@ void LanguageProtocol::Client::write_request(const std::string &method, const st auto id_it=handlers.find(message_id); if(id_it!=handlers.end()) { auto function=std::move(id_it->second); + handlers.erase(id_it->first); lock.unlock(); function(boost::property_tree::ptree(), false); lock.lock(); - handlers.erase(id_it->first); } }); } @@ -236,10 +236,10 @@ void LanguageProtocol::Client::write_request(const std::string &method, const st auto id_it=handlers.find(message_id); if(id_it!=handlers.end()) { auto function=std::move(id_it->second); + handlers.erase(id_it->first); lock.unlock(); function(boost::property_tree::ptree(), false); lock.lock(); - handlers.erase(id_it->first); } } }