diff --git a/components/sqlite3/db.cpp b/components/sqlite3/db.cpp index 54a156057d..b1e3afb1ae 100644 --- a/components/sqlite3/db.cpp +++ b/components/sqlite3/db.cpp @@ -16,7 +16,10 @@ namespace Sqlite3 Db makeDb(std::string_view path, const char* schema) { sqlite3* handle = nullptr; - const int flags = SQLITE_OPEN_READWRITE | SQLITE_OPEN_CREATE; + // All uses of NavMeshDb are protected by a mutex (navmeshtool) or serialized in a single thread (DbWorker) + // so additional synchronization between threads is not required and SQLITE_OPEN_NOMUTEX can be used. + // This is unsafe to use NavMeshDb without external synchronization because of internal state. + const int flags = SQLITE_OPEN_READWRITE | SQLITE_OPEN_CREATE | SQLITE_OPEN_NOMUTEX; if (const int ec = sqlite3_open_v2(std::string(path).c_str(), &handle, flags, nullptr); ec != SQLITE_OK) { const std::string message(sqlite3_errmsg(handle));