D18567: Make testActiveDocumentsGetBestPriority() clean up after itself

Thomas Schöps noreply at phabricator.kde.org
Sat Apr 6 13:16:32 BST 2019

thomassc added a comment.

  Thanks for the update. Seems good to me.
  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.
  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 `auto`:
    diff --git a/kdevplatform/tests/testfile.cpp b/kdevplatform/tests/testfile.cpp
    index aab8906f3a..29f4e572d7 100644
    --- a/kdevplatform/tests/testfile.cpp
    +++ b/kdevplatform/tests/testfile.cpp
    @@ -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
    +    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;

  R32 KDevelop


To: arrowd, #kdevelop, mwolff, thomassc
Cc: mwolff, kdevelop-devel, gennad, glebaccon, domson, antismap, iodelay, alexeymin, geetamc, Pilzschaf, akshaydeo, surgenight, arrowd
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://mail.kde.org/pipermail/kdevelop-devel/attachments/20190406/4c39524c/attachment.html>

More information about the KDevelop-devel mailing list