| 941 | } |
| 942 | |
| 943 | void BackgroundParser::documentClosed(IDocument* document) |
| 944 | { |
| 945 | Q_D(BackgroundParser); |
| 946 | |
| 947 | QMutexLocker l(&d->m_mutex); |
| 948 | |
| 949 | if (document->textDocument()) { |
| 950 | KTextEditor::Document* textDocument = document->textDocument(); |
| 951 | |
| 952 | auto documentUrlIt = d->m_managedTextDocumentUrls.find(textDocument); |
| 953 | if (documentUrlIt == d->m_managedTextDocumentUrls.end()) |
| 954 | return; // Probably the document had an invalid url, and thus it wasn't added to the background parser |
| 955 | |
| 956 | Q_ASSERT(documentUrlIt != d->m_managedTextDocumentUrls.end()); |
| 957 | |
| 958 | IndexedString url(*documentUrlIt); |
| 959 | |
| 960 | QMutexLocker l2(&d->m_managedMutex); |
| 961 | auto urlIt = d->m_managed.find(url); |
| 962 | Q_ASSERT(urlIt != d->m_managed.end()); |
| 963 | Q_ASSERT(*urlIt); |
| 964 | Q_ASSERT((*urlIt)->document() == textDocument); |
| 965 | |
| 966 | qCDebug(LANGUAGE) << "removing" << url.str() << "from background parser"; |
| 967 | delete *urlIt; |
| 968 | d->m_managedTextDocumentUrls.erase(documentUrlIt); |
| 969 | d->m_managed.erase(urlIt); |
| 970 | } |
| 971 | } |
| 972 | |
| 973 | void BackgroundParser::documentLoaded(IDocument* document) |
| 974 | { |
nothing calls this directly
no test coverage detected