| 133 | } |
| 134 | |
| 135 | void ProblemReporterPlugin::documentClosed(IDocument* doc) |
| 136 | { |
| 137 | if (!doc->textDocument()) |
| 138 | return; |
| 139 | |
| 140 | const IndexedString url(doc->url()); |
| 141 | |
| 142 | const auto it = m_visualizers.constFind(url); |
| 143 | if (it == m_visualizers.cend()) { |
| 144 | qCDebug(PLUGIN_PROBLEMREPORTER) << "closed an unregistered text document:" << doc << doc->url().toString(); |
| 145 | return; |
| 146 | } |
| 147 | |
| 148 | if (it.value()->document() != doc->textDocument()) { |
| 149 | // doc is being renamed, DocumentControllerPrivate::changeDocumentUrl() is closing it |
| 150 | // because of a conflict with another open modified document at doc's new URL. |
| 151 | // documentUrlChanged(doc, ...) will be invoked soon and will remove doc's visualizer. Nothing to do here. |
| 152 | qCDebug(PLUGIN_PROBLEMREPORTER) << "closed a text document that shares another text document's URL:" << doc |
| 153 | << doc->url().toString(); |
| 154 | return; |
| 155 | } |
| 156 | |
| 157 | delete it.value(); |
| 158 | m_visualizers.erase(it); |
| 159 | m_reHighlightNeeded.remove(url); |
| 160 | } |
| 161 | |
| 162 | void ProblemReporterPlugin::textDocumentCreated(KDevelop::IDocument* document) |
| 163 | { |