| 1766 | } |
| 1767 | |
| 1768 | uint DUChain::newTopContextIndex() |
| 1769 | { |
| 1770 | { |
| 1771 | QMutexLocker lock(&sdDUChainPrivate->m_chainsMutex); |
| 1772 | if (!sdDUChainPrivate->m_availableTopContextIndices.isEmpty()) { |
| 1773 | uint ret = sdDUChainPrivate->m_availableTopContextIndices.back(); |
| 1774 | sdDUChainPrivate->m_availableTopContextIndices.pop_back(); |
| 1775 | if (TopDUContextDynamicData::fileExists(ret)) { |
| 1776 | qCWarning(LANGUAGE) << "Problem in the management of available top-context indices"; |
| 1777 | return newTopContextIndex(); |
| 1778 | } |
| 1779 | return ret; |
| 1780 | } |
| 1781 | } |
| 1782 | static QAtomicInt& currentId(globalItemRepositoryRegistry().customCounter(QStringLiteral("Top-Context Counter"), |
| 1783 | 1)); |
| 1784 | return currentId.fetchAndAddRelaxed(1); |
| 1785 | } |
| 1786 | |
| 1787 | void DUChain::refCountUp(TopDUContext* top) |
| 1788 | { |