Bug 386901

Summary: ASSERT: "KDevelop::DUChain::lock()->currentThreadHasReadLock() || KDevelop::DUChain::lock()->currentThreadHasWriteLock()" in file kdevplatform/language/duchain/functiondefinition.cpp
Product: [Applications] kdevelop Reporter: David Faure <faure>
Component: generalAssignee: kdevelop-bugs-null
Status: RESOLVED FIXED    
Severity: normal    
Priority: NOR    
Version: git master   
Target Milestone: ---   
Platform: Other   
OS: Linux   
Latest Commit: Version Fixed In: 5.2.1

Description David Faure 2017-11-14 12:14:35 UTC
With the kdepim libraries from Applications/17.12 installed:
git clone kde:zanshin
cd zanshin
git checkout a6613f66
wget http://www.davidfaure.fr/2017/zanshin_partial_port_to_qdatetime.diff
git apply zanshin_partial_port_to_qdatetime.diff
kdevelop
Open Project zanshin
Go to akonadiserializertest.cpp, line 570.
The code on that line does not compile, QDateTime vs QDate mixup.
For this reason, "setTodoDates" is underlined, correctly.
In the popup on that function name, one can read "See: void setTodoDates(KCalCore::Todo::Ptr, const QDate&, const QDate&) in akonadiserializertest.cpp :47".
Click on the link to setTodoDates -> crash. Reproduced 3 times in a row.
Comment 1 Kevin Funk 2017-11-14 12:26:17 UTC
Can reproduce.

Backtrace:

(gdb) bt 25
#0  0x00007ffff0bae0bb in __GI_raise (sig=sig@entry=6) at ../sysdeps/unix/sysv/linux/raise.c:51
#1  0x00007ffff0baff5d in __GI_abort () at abort.c:90
#2  0x00007ffff18e35c8 in qt_message_fatal(QtMsgType, QMessageLogContext const&, QString const&) (context=..., message="ASSERT: \"KDevelop::DUChain::lock()->currentThreadHasReadLock() || KDevelop::DUChain::lock()->currentThreadHasWriteLock()\" in file /home/kfunk/devel/src/kf5/kdevelop/kdevplatform/language/duchain
/funct"...) at /home/kfunk/devel/src/qt5.9/qtbase/src/corelib/global/qlogging.cpp:1690
#3  0x00007ffff18e40ad in QMessageLogger::fatal(char const*, ...) const (this=0x7fffffff8a20, msg=<optimized out>) at /home/kfunk/devel/src/qt5.9/qtbase/src/corelib/global/qlogging.cpp:796
#4  0x00007ffff18dd3cc in qt_assert(char const*, char const*, int) (assertion=<optimized out>, file=<optimized out>, line=<optimized out>) at /home/kfunk/devel/src/qt5.9/qtbase/src/corelib/global/qglobal.cpp:3077
#5  0x00007fffeec6f326 in KDevelop::FunctionDefinition::declaration(KDevelop::TopDUContext const*) const (this=0x7fff7a0cb380, topContext=0x0) at /home/kfunk/devel/src/kf5/kdevelop/kdevplatform/language/duchain/functiondefinition.cpp:49
#6  0x00007fffeed3ee4d in KDevelop::AbstractDeclarationNavigationContext::AbstractDeclarationNavigationContext(KDevelop::DUChainPointer<KDevelop::Declaration> const&, KDevelop::DUChainPointer<KDevelop::TopDUContext> const&, KDevelop::AbstractNavigationContext*) (this=0x2b0dbc0, decl=..., topContext=..., previousCon
text=0x0) at /home/kfunk/devel/src/kf5/kdevelop/kdevplatform/language/duchain/navigation/abstractdeclarationnavigationcontext.cpp:65
#7  0x00007fffa98e4062 in DeclarationNavigationContext::AbstractDeclarationNavigationContext(KDevelop::DUChainPointer<KDevelop::Declaration> const&, KDevelop::AbstractDeclarationNavigationContext<KDevelop::TopDUContext> const&, KDevelop::AbstractNavigationContext*) (this=0x2b0dbc0) at /home/kfunk/devel/src/kf5/kdev
elop/plugins/clang/duchain/navigationwidget.cpp:37
#8  0x00007fffa98e3ae0 in ClangNavigationWidget::ClangNavigationWidget(KDevelop::DUChainPointer<KDevelop::Declaration> const&, QFlags<KDevelop::AbstractNavigationWidget::DisplayHint>) (this=0x8b81bf0, declaration=..., hints=...) at /home/kfunk/devel/src/kf5/kdevelop/plugins/clang/duchain/navigationwidget.cpp:95
#9  0x00007fffa98b5485 in ClangDUContext<KDevelop::TopDUContext, 140>::createNavigationWidget(KDevelop::Declaration*, KDevelop::TopDUContext*, QString const&, QString const&, QFlags<KDevelop::AbstractNavigationWidget::DisplayHint>) const (this=0x7fff7a0ab650, decl=0x7fff7a0cb380, topContext=0x0, htmlPrefix="", html
Suffix="", hints=...) at /home/kfunk/devel/src/kf5/kdevelop/plugins/clang/duchain/clangducontext.cpp:46
#10 0x00007fffeed38344 in KDevelop::AbstractNavigationContext::registerChild(KDevelop::DUChainPointer<KDevelop::Declaration> const&) (this=0x8c5dc60, declaration=...) at /home/kfunk/devel/src/kf5/kdevelop/kdevplatform/language/duchain/navigation/abstractnavigationcontext.cpp:277
#11 0x00007fffeed37a9e in KDevelop::AbstractNavigationContext::execute(KDevelop::NavigationAction const&) (this=0x8c5dc60, action=...) at /home/kfunk/devel/src/kf5/kdevelop/kdevplatform/language/duchain/navigation/abstractnavigationcontext.cpp:211
#12 0x00007fffeed39102 in KDevelop::AbstractNavigationContext::acceptLink(QString const&) (this=0x8c5dc60, link="link_0") at /home/kfunk/devel/src/kf5/kdevelop/kdevplatform/language/duchain/navigation/abstractnavigationcontext.cpp:437
#13 0x00007fffeed3452a in KDevelop::AbstractNavigationWidgetPrivate::anchorClicked(QUrl const&) (this=0x14ea3f0, url="link_0") at /home/kfunk/devel/src/kf5/kdevelop/kdevplatform/language/duchain/navigation/abstractnavigationwidget.cpp:257
#14 0x00007fffeed352cf in KDevelop::AbstractNavigationWidget::initBrowser(int)::$_1::operator()(QUrl const&) const (this=0x8b7afd0, url="link_0") at /home/kfunk/devel/src/kf5/kdevelop/kdevplatform/language/duchain/navigation/abstractnavigationwidget.cpp:117
#15 0x00007fffeed35281 in QtPrivate::FunctorCall<QtPrivate::IndexesList<0>, QtPrivate::List<QUrl const&>, void, KDevelop::AbstractNavigationWidget::initBrowser(int)::$_1>::call(KDevelop::AbstractNavigationWidget::initBrowser(int)::$_1&, void**) (f=..., arg=0x7fffffffa4f0) at /home/kfunk/devel/build/qt5.9/qtbase/inc
lude/QtCore/../../../../../src/qt5.9/qtbase/src/corelib/kernel/qobjectdefs_impl.h:130
Comment 2 Kevin Funk 2017-11-14 12:37:48 UTC
Git commit 4db1ad101728b1a9b9cb02dc4aa3373274a99cd8 by Kevin Funk.
Committed on 14/11/2017 at 12:37.
Pushed by kfunk into branch '5.2'.

abstractnavigationwidget: Add missing DUChain lock

Otherwise this might cause a crash when clicking on items in the
navigation tooltips.
FIXED-IN: 5.2.1

M  +2    -0    kdevplatform/language/duchain/navigation/abstractnavigationwidget.cpp

https://commits.kde.org/kdevelop/4db1ad101728b1a9b9cb02dc4aa3373274a99cd8
Comment 3 Kevin Funk 2017-11-14 12:38:37 UTC
Git commit ff72bc3266a27c76834de9c1d998d02c57d2591e by Kevin Funk.
Committed on 14/11/2017 at 12:36.
Pushed by kfunk into branch 'master'.

abstractnavigationwidget: Add missing DUChain lock

Otherwise this might cause a crash when clicking on items in the
navigation tooltips.
FIXED-IN: 5.2.1

M  +2    -0    kdevplatform/language/duchain/navigation/abstractnavigationwidget.cpp

https://commits.kde.org/kdevelop/ff72bc3266a27c76834de9c1d998d02c57d2591e