diff --git a/entwine/third/arbiter/arbiter.cpp b/entwine/third/arbiter/arbiter.cpp index c3942ff8..1ccbfc89 100644 --- a/entwine/third/arbiter/arbiter.cpp +++ b/entwine/third/arbiter/arbiter.cpp @@ -353,13 +353,16 @@ std::shared_ptr Arbiter::getDriver(const std::string path) const { const auto type(getProtocol(path)); - std::lock_guard lock(m_mutex); - auto it = m_drivers.find(type); - if (it != m_drivers.end()) return it->second; + { + std::lock_guard lock(m_mutex); + auto it = m_drivers.find(type); + if (it != m_drivers.end()) return it->second; + } const json config = getConfig(m_config); if (auto driver = Driver::create(*m_pool, type, config.dump())) { + std::lock_guard lock(m_mutex); m_drivers[type] = driver; return driver; }