Commit 925db80b authored by Igor Kushnir's avatar Igor Kushnir Committed by Milian Wolff
Browse files

Don't lock ItemRepository's mutex in its constructor

ItemRepositoryRegistry::registerRepository() is called only from within
ItemRepository's constructor, so it doesn't need to lock the
repository's mutex.
parent 154a9524
......@@ -206,7 +206,7 @@ void ItemRepositoryRegistry::registerRepository(AbstractItemRepository* reposito
QMutexLocker lock(&d->m_mutex);
d->m_repositories.insert(repository, manager);
if (!d->m_path.isEmpty()) {
std::scoped_lock repoLock(*repository);
// Locking the repository is documented as the caller's responsibility.
if (!repository->open(d->m_path)) {
qCritical() << "failed to open a repository";
......@@ -44,6 +44,7 @@ public:
/// Add a new repository.
/// It will automatically be opened with the current path, if one is set.
/// @note A caller of this function, other than @p repository's constructor, must hold @p repository's mutex lock.
void registerRepository(AbstractItemRepository* repository, AbstractRepositoryManager* manager);
/// Remove a repository.
Supports Markdown
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment