Commit 38e910ba authored by Milian Wolff's avatar Milian Wolff

Lock duchain in AbstractIncludeNavigationContext::html

Fixes assertion when trying to navigate in project file
quick open navigation widget:

#9  0x00007fc05e472c28 in qt_assert(char const*, char const*, int) () from /usr/lib/libQt5Core.so.5
#10 0x00007fc061696c26 in KDevelop::TopDUContext::importedParentContexts (this=0x561284615030) at /home/milian/projects/kf5/src/extragear/kdevelop/kdevelop/kdevplatform/language/duchain/topducontext.cpp:1015
#11 0x00007fc0617883cc in KDevelop::pickContextWithData (duchains=..., maxDepth=2, type=@0x561287177ac0: KDevelop::StandardParsingEnvironment, forcePick=true) at /home/milian/projects/kf5/src/extragear/kdevelop/kdevelop/kdevplatform/language/duchain/navigation/abstractincludenavigationcontext.cpp:60
#12 0x00007fc061788815 in KDevelop::AbstractIncludeNavigationContext::html (this=0x561287177aa0, shorten=false) at /home/milian/projects/kf5/src/extragear/kdevelop/kdevelop/kdevplatform/language/duchain/navigation/abstractincludenavigationcontext.cpp:90
#13 0x00007fc0617752fb in KDevelop::AbstractNavigationContext::down (this=0x561287177aa0) at /home/milian/projects/kf5/src/extragear/kdevelop/kdevelop/kdevplatform/language/duchain/navigation/abstractnavigationcontext.cpp:282
parent 12e3583f
......@@ -23,6 +23,7 @@
#include <language/duchain/duchain.h>
#include <language/duchain/parsingenvironment.h>
#include <language/duchain/declaration.h>
#include <language/duchain/duchainlock.h>
namespace KDevelop {
AbstractIncludeNavigationContext::AbstractIncludeNavigationContext(const IncludeItem& item,
......@@ -84,6 +85,7 @@ QString AbstractIncludeNavigationContext::html(bool shorten)
makeLink(u.toDisplayString(QUrl::PreferLocalFile), u.toString(), action);
modifyHtml() += QStringLiteral("<br />");
DUChainReadLocker lock;
QList<TopDUContext*> duchains = DUChain::self()->chainsForDocument(u);
//Pick the one duchain for this document that has the most child-contexts/declarations.
//This prevents picking a context that is empty due to header-guards.
......
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