Commit 7310d147 authored by Milian Wolff's avatar Milian Wolff
Browse files

Cleanup: only lock mutex once in IndexedIdentifier::operator=

This approach was already used in IndexedQualifiedIdentifier's
operator= and I see no reason to not do it here too.
parent e9999b35
......@@ -1314,14 +1314,12 @@ IndexedIdentifier& IndexedIdentifier::operator=(unsigned int index)
if (shouldDoDUChainReferenceCounting(this)) {
QMutexLocker lock(identifierRepository()->mutex());
decrease(identifierRepository()->dynamicItemFromIndexSimple(m_index)->m_refCount, m_index);
}
m_index = index;
if (shouldDoDUChainReferenceCounting(this)) {
QMutexLocker lock(identifierRepository()->mutex());
m_index = index;
increase(identifierRepository()->dynamicItemFromIndexSimple(m_index)->m_refCount, m_index);
} else {
m_index = index;
}
return *this;
}
......
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