diff --git a/plugins/filetemplates/templatepreviewtoolview.cpp b/plugins/filetemplates/templatepreviewtoolview.cpp --- a/plugins/filetemplates/templatepreviewtoolview.cpp +++ b/plugins/filetemplates/templatepreviewtoolview.cpp @@ -77,10 +77,6 @@ void TemplatePreviewToolView::documentActivated(KDevelop::IDocument* document) { - if (!isVisible()) { - return; - } - documentChanged(document->textDocument()); } @@ -136,12 +132,10 @@ void TemplatePreviewToolView::documentClosed(IDocument* document) { - if (!isVisible()) { - return; - } + m_original = nullptr; if (document && document->textDocument() == m_original) { - documentChanged(0); + documentChanged(nullptr); } } diff --git a/plugins/outlineview/outlinemodel.cpp b/plugins/outlineview/outlinemodel.cpp --- a/plugins/outlineview/outlinemodel.cpp +++ b/plugins/outlineview/outlinemodel.cpp @@ -51,7 +51,16 @@ // and also when we switch the current document connect(docController, &IDocumentController::documentActivated, this, &OutlineModel::rebuildOutline); - connect(docController, &IDocumentController::documentUrlChanged, this, [this](IDocument* doc) { + connect(docController, &IDocumentController::documentClosed, + this, [this](IDocument* doc) { + if (doc == m_lastDoc) { + m_lastDoc = nullptr; + m_lastUrl = IndexedString(); + rebuildOutline(nullptr); + } + }); + connect(docController, &IDocumentController::documentUrlChanged, + this, [this](IDocument* doc) { if (doc == m_lastDoc) { m_lastUrl = IndexedString(doc->url()); }