| 1731 | } |
| 1732 | |
| 1733 | void DUChain::shutdown() |
| 1734 | { |
| 1735 | // if core is not shutting down, we can end up in deadlocks or crashes |
| 1736 | // since language plugins might still try to access static duchain stuff |
| 1737 | Q_ASSERT(!ICore::self() || ICore::self()->shuttingDown()); |
| 1738 | |
| 1739 | qCDebug(LANGUAGE) << "Cleaning up and shutting down DUChain"; |
| 1740 | |
| 1741 | QMutexLocker lock(&sdDUChainPrivate->cleanupMutex()); |
| 1742 | |
| 1743 | { |
| 1744 | //Acquire write-lock of the repository, so when kdevelop crashes in that process, the repository is discarded |
| 1745 | //Crashes here may happen in an inconsistent state, thus this makes sense, to protect the user from more crashes |
| 1746 | globalItemRepositoryRegistry().lockForWriting(); |
| 1747 | sdDUChainPrivate->cleanupTopContexts(); |
| 1748 | globalItemRepositoryRegistry().unlockForWriting(); |
| 1749 | } |
| 1750 | |
| 1751 | sdDUChainPrivate->doMoreCleanup(); //Must be done _before_ finalCleanup, else we may be deleting yet needed data |
| 1752 | |
| 1753 | sdDUChainPrivate->m_openDocumentContexts.clear(); |
| 1754 | sdDUChainPrivate->m_destroyed = true; |
| 1755 | sdDUChainPrivate->clear(); |
| 1756 | |
| 1757 | { |
| 1758 | //Acquire write-lock of the repository, so when kdevelop crashes in that process, the repository is discarded |
| 1759 | //Crashes here may happen in an inconsistent state, thus this makes sense, to protect the user from more crashes |
| 1760 | globalItemRepositoryRegistry().lockForWriting(); |
| 1761 | finalCleanup(); |
| 1762 | globalItemRepositoryRegistry().unlockForWriting(); |
| 1763 | } |
| 1764 | |
| 1765 | globalItemRepositoryRegistry().shutdown(); |
| 1766 | } |
| 1767 | |
| 1768 | uint DUChain::newTopContextIndex() |
| 1769 | { |