StaticAssistantsManager: Fix crash-on-exit
==27434==ERROR: AddressSanitizer: heap-use-after-free on address 0x604000535850 at pc 0x7fecf16970c1 bp 0x7fffa6344e70 sp 0x7fffa6344e68 READ of size 8 at 0x604000535850 thread T0 #0 0x7fecf16970c0 in KDevelop::TopDUContext::problems() const /home/kfunk/devel/src/kf5/kdevplatform-stable/language/duchain/topducontext.cpp:924:8 #1 0x7fecf119134b in KDevelop::StaticAssistantsManager::Private::checkAssistantForProblems(KDevelop::TopDUContext*) /home/kfunk/devel/src/kf5/kdevplatform-stable/language/assistant/staticassistantsmanager.cpp:288:112 #2 0x7fecf1190f30 in KDevelop::StaticAssistantsManager::Private::updateReady(KDevelop::IndexedString const&, KDevelop::ReferencedTopDUContext const&) /home/kfunk/devel/src/kf5/kdevplatform-stable/language/assistant/staticassistantsmanager.cpp:251:9 0x604000535850 is located 0 bytes inside of 48-byte region [0x604000535850,0x604000535880) freed by thread T0 here: #0 0x4e2b82 in operator delete(void*) (/home/kfunk/devel/install/kf5-stable/bin/kdevelop+0x4e2b82) #1 0x7fecbc09fa25 in ClangDUContext<KDevelop::TopDUContext, 140>::~ClangDUContext() /home/kfunk/devel/src/kf5/kdevelop-stable/languages/clang/duchain/clangducontext.h:29:7 #2 0x7fecf169582f in KDevelop::TopDUContext::deleteSelf() /home/kfunk/devel/src/kf5/kdevplatform-stable/language/duchain/topducontext.cpp:580:3 #3 0x7fecf1407bc7 in KDevelop::DUChainPrivate::removeDocumentChainFromMemory(KDevelop::TopDUContext*) /home/kfunk/devel/src/kf5/kdevplatform-stable/language/duchain/duchain.cpp:407:5 #4 0x7fecf141c74a in KDevelop::DUChainPrivate::clear() /home/kfunk/devel/src/kf5/kdevplatform-stable/language/duchain/duchain.cpp:370:7 #5 0x7fecf13ffa55 in KDevelop::DUChain::shutdown() /home/kfunk/devel/src/kf5/kdevplatform-stable/language/duchain/duchain.cpp:1598:3 #6 0x7fecfac6ac45 in KDevelop::Core::cleanup() /home/kfunk/devel/src/kf5/kdevplatform-stable/shell/core.cpp:454:9 #7 0x7fecfac69230 in KDevelop::Core::shutdown() previously allocated by thread T8 (Queue(0x6040004) here: #0 0x4e25c2 in operator new(unsigned long) (/home/kfunk/devel/install/kf5-stable/bin/kdevelop+0x4e25c2) #1 0x7fecbc0a1dcc in (anonymous namespace)::createTopContext(KDevelop::IndexedString const&, ClangParsingEnvironment const&) /home/kfunk/devel/src/kf5/kdevelop-stable/languages/clang/duchain/clanghelpers.cpp:76:38 #2 0x7fecbc0a1dcc in ClangHelpers::buildDUChain(void*, QMultiHash<void*, Import> const&, ParseSession const&, KDevelop::TopDUContext::Features, QHash<void*, KDevelop::ReferencedTopDUContext>&, ClangIndex*) /home/kfunk/devel/src/kf5/kdevelop-stable/languages/clang/duchain/clanghelpers.cpp:127