Commit 4acac3f7 authored by Thomas Schöps's avatar Thomas Schöps

TestFile: On destruction, close associated document if open and stop the background parser

Differential Revision: https://phabricator.kde.org/D18567
parent 5e17ba4c
......@@ -30,6 +30,7 @@
#include <language/duchain/duchain.h>
#include <language/backgroundparser/backgroundparser.h>
#include <interfaces/icore.h>
#include <interfaces/idocumentcontroller.h>
#include <interfaces/ilanguagecontroller.h>
#include <project/projectmodel.h>
......@@ -123,6 +124,14 @@ TestFile::TestFile(const QString& contents, const QString& fileExtension, const
TestFile::~TestFile()
{
if (auto* document = ICore::self()->documentController()->documentForUrl(d->url.toUrl())) {
document->close(KDevelop::IDocument::Discard);
}
auto backgroundParser = ICore::self()->languageController()->backgroundParser();
backgroundParser->removeDocument(d->url, this);
QTRY_VERIFY(!backgroundParser->parseJobForDocument(d->url));
if (d->topContext && !d->keepDUChainData) {
DUChainWriteLocker lock;
DUChain::self()->removeDocumentChain(d->topContext.data());
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment