mirror of
https://gitee.com/zyjblog/oatpp.git
synced 2024-12-22 22:16:37 +08:00
Fix possible race condition on destroy
This commit is contained in:
parent
e544cf76a8
commit
23d2070a6d
@ -216,10 +216,12 @@ void Environment::init(const std::shared_ptr<Logger>& logger) {
|
||||
}
|
||||
|
||||
void Environment::destroy(){
|
||||
if(getComponents().size() > 0) {
|
||||
{
|
||||
std::lock_guard<std::mutex> lock(getComponentsMutex());
|
||||
throw std::runtime_error("[oatpp::base::Environment::destroy()]: Error. "
|
||||
"Invalid state. Leaking components");
|
||||
if(getComponents().size() > 0) {
|
||||
throw std::runtime_error("[oatpp::base::Environment::destroy()]: Error. "
|
||||
"Invalid state. Leaking components");
|
||||
}
|
||||
}
|
||||
m_logger.reset();
|
||||
|
||||
|
Loading…
Reference in New Issue
Block a user