Commit 005e211e authored by Milian Wolff's avatar Milian Wolff
Browse files

Construct item request for identifiers without holding lock

This restores the behavior of the old code. Thanks for Igor
Kushnir for pointing this out!
parent a2782fac
......@@ -637,11 +637,12 @@ void Identifier::makeConstant() const
if (m_index)
return;
LockedItemRepository::write<IndexedIdentifier>([&](IdentifierRepository& repo) {
m_index = repo.index(IdentifierItemRequest(*dd));
delete dd;
cd = repo.itemFromIndex(m_index);
});
LockedItemRepository::write<IndexedIdentifier>(
[&, request = IdentifierItemRequest(*dd)](IdentifierRepository& repo) {
m_index = repo.index(request);
delete dd;
cd = repo.itemFromIndex(m_index);
});
}
void Identifier::prepareWrite()
......@@ -664,9 +665,10 @@ bool QualifiedIdentifier::inRepository() const
if (m_index)
return true;
return LockedItemRepository::read<IndexedQualifiedIdentifier>([&](const QualifiedIdentifierRepository& repo) {
return static_cast<bool>(repo.findIndex(QualifiedIdentifierItemRequest(*dd)));
});
return LockedItemRepository::read<IndexedQualifiedIdentifier>(
[&, request = QualifiedIdentifierItemRequest(*dd)](const QualifiedIdentifierRepository& repo) {
return static_cast<bool>(repo.findIndex(request));
});
}
QualifiedIdentifier::QualifiedIdentifier(uint index)
......@@ -1140,11 +1142,12 @@ void QualifiedIdentifier::makeConstant() const
if (m_index)
return;
LockedItemRepository::write<IndexedQualifiedIdentifier>([&](QualifiedIdentifierRepository& repo) {
m_index = repo.index(QualifiedIdentifierItemRequest(*dd));
delete dd;
cd = repo.itemFromIndex(m_index);
});
LockedItemRepository::write<IndexedQualifiedIdentifier>(
[&, request = QualifiedIdentifierItemRequest(*dd)](QualifiedIdentifierRepository& repo) {
m_index = repo.index(request);
delete dd;
cd = repo.itemFromIndex(m_index);
});
}
void QualifiedIdentifier::prepareWrite()
......
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