mirror of
https://github.com/bitcoin/bitcoin.git
synced 2025-03-10 17:17:14 +01:00
`ArgsManager::m_cached_blocks_path` is protected by `ArgsManager::cs_args` and returning a reference to it after releasing the mutex is unsafe. To resolve this, return a copy of the path. This has some performance penalty which is presumably ok, given that paths are a few 100s bytes at most and `GetBlocksDirPath()` is not called often. This silences the following (clang 18): ``` common/args.cpp:288:31: error: returning variable 'm_cached_blocks_path' by reference requires holding mutex 'cs_args' [-Werror,-Wthread-safety-reference-return] 288 | if (!path.empty()) return path; | ^ ``` Do the same with `ArgsManager::GetDataDir()`, `ArgsManager::GetDataDirBase()` and `ArgsManager::GetDataDirNet()`. |
||
---|---|---|
.. | ||
args.cpp | ||
args.h | ||
bloom.cpp | ||
bloom.h | ||
config.cpp | ||
init.cpp | ||
init.h | ||
interfaces.cpp | ||
run_command.cpp | ||
run_command.h | ||
settings.cpp | ||
settings.h | ||
system.cpp | ||
system.h | ||
url.cpp | ||
url.h |