<table><tr><td style="">thomassc added a comment.
</td><a style="text-decoration: none; padding: 4px 8px; margin: 0 8px 8px; float: right; color: #464C5C; font-weight: bold; border-radius: 3px; background-color: #F7F7F9; background-image: linear-gradient(to bottom,#fff,#f1f0f1); display: inline-block; border: 1px solid rgba(71,87,120,.2);" href="https://phabricator.kde.org/D18567">View Revision</a></tr></table><br /><div><div><p>Thanks for the update. Seems good to me.</p>

<p>Yes, I think this should fix the original issue, since it manages to close the documents that the test leaves open without crashing, and when adding the new tests from the other patch that first caused the issue, I don't see any problems anymore.</p>

<p>I tried to also address Milian's other comment, but seemingly couldn't update the patch here anymore (or didn't find how to). So this would be the diff with use of the <tt style="background: #ebebeb; font-size: 13px;">auto</tt>:</p>

<div class="remarkup-code-block" style="margin: 12px 0;" data-code-lang="diff" data-sigil="remarkup-code-block"><pre class="remarkup-code" style="font: 11px/15px "Menlo", "Consolas", "Monaco", monospace; padding: 12px; margin: 0; background: rgba(71, 87, 120, 0.08);"><span style="color: #000080">diff --git a/kdevplatform/tests/testfile.cpp b/kdevplatform/tests/testfile.cpp</span>
<span style="color: #000080">index aab8906f3a..29f4e572d7 100644</span>
<span style="color: #a00000">--- a/kdevplatform/tests/testfile.cpp</span>
<span style="color: #00a000">+++ b/kdevplatform/tests/testfile.cpp</span>
<span style="color: #800080">@@ -30,6 +30,7 @@</span>
 #include <language/duchain/duchain.h>
 #include <language/backgroundparser/backgroundparser.h>
 #include <interfaces/icore.h>
<span style="color: #00a000">+#include <interfaces/idocumentcontroller.h></span>
 #include <interfaces/ilanguagecontroller.h>
 #include <project/projectmodel.h>
 
<span style="color: #800080">@@ -123,6 +124,14 @@ TestFile::TestFile(const QString& contents, const QString& fileExtension, const</span>
 
 TestFile::~TestFile()
 {
<span style="color: #00a000">+    if (auto* document = ICore::self()->documentController()->documentForUrl(d->url.toUrl())) {</span>
<span style="color: #00a000">+        document->close(KDevelop::IDocument::Discard);</span>
<span style="color: #00a000">+    }</span>
<span style="color: #00a000">+</span>
<span style="color: #00a000">+    auto backgroundParser = ICore::self()->languageController()->backgroundParser();</span>
<span style="color: #00a000">+    backgroundParser->removeDocument(d->url, this);</span>
<span style="color: #00a000">+    QTRY_VERIFY(!backgroundParser->parseJobForDocument(d->url));</span>
<span style="color: #00a000">+</span>
     if (d->topContext && !d->keepDUChainData) {
         DUChainWriteLocker lock;
         DUChain::self()->removeDocumentChain(d->topContext.data());</pre></div></div></div><br /><div><strong>REPOSITORY</strong><div><div>R32 KDevelop</div></div></div><br /><div><strong>REVISION DETAIL</strong><div><a href="https://phabricator.kde.org/D18567">https://phabricator.kde.org/D18567</a></div></div><br /><div><strong>To: </strong>arrowd, KDevelop, mwolff, thomassc<br /><strong>Cc: </strong>mwolff, kdevelop-devel, gennad, glebaccon, domson, antismap, iodelay, alexeymin, geetamc, Pilzschaf, akshaydeo, surgenight, arrowd<br /></div>