| 425 | } |
| 426 | |
| 427 | void clear() |
| 428 | { |
| 429 | if (!m_cleanupDisabled) |
| 430 | doMoreCleanup(); |
| 431 | |
| 432 | DUChainWriteLocker writeLock(DUChain::lock()); |
| 433 | |
| 434 | QMutexLocker l(&m_chainsMutex); |
| 435 | |
| 436 | const auto currentChainsByUrl = m_chainsByUrl; |
| 437 | for (TopDUContext* top : currentChainsByUrl) { |
| 438 | removeDocumentChainFromMemory(top); |
| 439 | } |
| 440 | |
| 441 | m_indexEnvironmentInformations.clear(); |
| 442 | m_fileEnvironmentInformations.clear(); |
| 443 | |
| 444 | Q_ASSERT(m_fileEnvironmentInformations.isEmpty()); |
| 445 | Q_ASSERT(m_chainsByUrl.isEmpty()); |
| 446 | } |
| 447 | |
| 448 | ///DUChain must be write-locked |
| 449 | ///Also removes from the environment-manager if the top-context is not on disk |