If there's unknown declaration found in source code, KDevelop will crash trying to show problem resolution box. Reproducible: Always Steps to Reproduce: 1. Create new project 2. Write random words in cpp file Proposed patch: http://pastebin.com/AgSggpXm
Interesting. Could you post the original backtrace for reference?
#1 0x00007fff67539ad3 in QConcatenable<QLatin1String>::appendTo (a="\000.h\000.hpp\000.H\000.hh\000hxx\000tlh\000h++\000\005", '\000' <repeats 11 times>, "QStringList {anonymous}::scanIncludePaths(const QString&, const QDir&, int)", '\000' <repeats 53 times>, "KDevelop::DocumentRange {anonymo"..., out=@0x7fffffffcc08: 0xda8df0) at /usr/include/x86_64-linux-gnu/qt5/QtCore/qstringbuilder.h:234 #2 0x00007fff6753ca95 in QConcatenable<QStringBuilder<QString, QLatin1String> >::appendTo<QChar> (p=..., out=@0x7fffffffcc08: 0xda8df0) at /usr/include/x86_64-linux-gnu/qt5/QtCore/qstringbuilder.h:366 #3 0x00007fff6753b441 in QStringBuilder<QString, QLatin1String>::convertTo<QString> (this=0x7fffffffcd30) at /usr/include/x86_64-linux-gnu/qt5/QtCore/qstringbuilder.h:112 #4 0x00007fff6753a27b in QStringBuilder<QString, QLatin1String>::operator QString (this=0x7fffffffcd30) at /usr/include/x86_64-linux-gnu/qt5/QtCore/qstringbuilder.h:125 #5 0x00007fff675365c7 in (anonymous namespace)::scanIncludePaths (identifier="adsf", dir=..., maxDepth=3) at /home/blackjack/projects/other/kdev-clang/duchain/unknowndeclarationproblem.cpp:96 #6 0x00007fff67536a63 in (anonymous namespace)::scanIncludePaths (identifier=..., includes={...}) at /home/blackjack/projects/other/kdev-clang/duchain/unknowndeclarationproblem.cpp:120 #7 0x00007fff67538cd7 in (anonymous namespace)::includeFiles (identifier=..., file=..., range=...) at /home/blackjack/projects/other/kdev-clang/duchain/unknowndeclarationproblem.cpp:407 #8 0x00007fff67539137 in (anonymous namespace)::fixUnknownDeclaration (identifier=..., file=..., docrange=...) at /home/blackjack/projects/other/kdev-clang/duchain/unknowndeclarationproblem.cpp:443 #9 0x00007fff6753973e in UnknownDeclarationProblem::solutionAssistant (this=0x7fffb4b393f0) at /home/blackjack/projects/other/kdev-clang/duchain/unknowndeclarationproblem.cpp:497 #10 0x00007ffff2f977b1 in KDevelop::StaticAssistantsManager::Private::checkAssistantForProblems (this=0x1e1e480, top=0x3243b90) at /home/blackjack/projects/other/kdevplatform/language/assistant/staticassistantsmanager.cpp:285 #11 0x00007ffff2f973a5 in KDevelop::StaticAssistantsManager::Private::parseJobFinished (this=0x1e1e480, job=0xe2d1a0) at /home/blackjack/projects/other/kdevplatform/language/assistant/staticassistantsmanager.cpp:246 #12 0x00007ffff2f9994a in KDevelop::StaticAssistantsManager::Private::Private(KDevelop::StaticAssistantsManager*)::{lambda(KDevelop::ParseJob*)#1}::operator()(KDevelop::ParseJob*) const () at /home/blackjack/projects/other/kdevplatform/language/assistant/staticassistantsmanager.cpp:52 #13 0x00007ffff2f9cba2 in QtPrivate::FunctorCall<QtPrivate::IndexesList<0>, QtPrivate::List<KDevelop::ParseJob*>, void, KDevelop::StaticAssistantsManager::Private::Private(KDevelop::StaticAssistantsManager*)::{lambda(KDevelop::ParseJob*)#1}>::call({lambda(KDevelop::ParseJob*)#1}, void**) (f=..., arg=0x7fffffffd3c0) at /usr/include/x86_64-linux-gnu/qt5/QtCore/qobjectdefs_impl.h:494 #14 0x00007ffff2f9c8f2 in QtPrivate::Functor<KDevelop::StaticAssistantsManager::Private::Private(KDevelop::StaticAssistantsManager*)::{lambda(KDevelop::ParseJob*)#1}, 1>::call<QtPrivate::List<KDevelop::ParseJob*>, void>({lambda(KDevelop::ParseJob*)#1}&, void*, {lambda(KDevelop::ParseJob*)#1}&*) (f=..., arg=0x7fffffffd3c0) at /usr/include/x86_64-linux-gnu/qt5/QtCore/qobjectdefs_impl.h:551 #15 0x00007ffff2f9c225 in QtPrivate::QFunctorSlotObject<KDevelop::StaticAssistantsManager::Private::Private(KDevelop::StaticAssistantsManager*)::{lambda(KDevelop::ParseJob*)#1}, 1, QtPrivate::List<KDevelop::ParseJob*>, void>::impl(int, QtPrivate::QSlotObjectBase*, QObject*, void**, bool*) (which=1, this_=0x1e1e500, r=0x1dd8260, a=0x7fffffffd3c0, ret=0x0) at /usr/include/x86_64-linux-gnu/qt5/QtCore/qobject_impl.h:192 #16 0x00007ffff55669fa in QMetaObject::activate(QObject*, int, int, void**) () from /usr/lib/x86_64-linux-gnu/libQt5Core.so.5 #17 0x00007ffff3176680 in KDevelop::BackgroundParser::parseJobFinished (this=0x1134c20, _t1=0xe2d1a0) at /home/blackjack/projects/other/build/kdevplatform/language/moc_backgroundparser.cpp:403 #18 0x00007ffff2fb4a09 in KDevelop::BackgroundParser::parseComplete (this=0x1134c20, job=...) at /home/blackjack/projects/other/kdevplatform/language/backgroundparser/backgroundparser.cpp:605 #19 0x00007ffff2fc151f in QtPrivate::FunctorCall<QtPrivate::IndexesList<0>, QtPrivate::List<QSharedPointer<ThreadWeaver::JobInterface> >, void, void (KDevelop::BackgroundParser::*)(QSharedPointer<ThreadWeaver::JobInterface> const&)>::call (f=(void (KDevelop::BackgroundParser::*)(KDevelop::BackgroundParser * const, const QSharedPointer<ThreadWeaver::JobInterface> &)) 0x7ffff2fb48fa <KDevelop::BackgroundParser::parseComplete(QSharedPointer<ThreadWeaver::JobInterface> const&)>, o=0x1134c20, arg=0x7fffb4afd3f0) at /usr/include/x86_64-linux-gnu/qt5/QtCore/qobjectdefs_impl.h:500 #20 0x00007ffff2fc09f4 in QtPrivate::FunctionPointer<void (KDevelop::BackgroundParser::*)(QSharedPointer<ThreadWeaver::JobInterface> const&)>::call<QtPrivate::List<QSharedPointer<ThreadWeaver::JobInterface> >, void> (f=(void (KDevelop::BackgroundParser::*)(KDevelop::BackgroundParser * const, const QSharedPointer<ThreadWeaver::JobInterface> &)) 0x7ffff2fb48fa <KDevelop::BackgroundParser::parseComplete(QSharedPointer<ThreadWeaver::JobInterface> const&)>, o=0x1134c20, arg=0x7fffb4afd3f0) at /usr/include/x86_64-linux-gnu/qt5/QtCore/qobjectdefs_impl.h:519 #21 0x00007ffff2fbf1c7 in QtPrivate::QSlotObject<void (KDevelop::BackgroundParser::*)(QSharedPointer<ThreadWeaver::JobInterface> const&), QtPrivate::List<QSharedPointer<ThreadWeaver::JobInterface> >, void>::impl (which=1, this_=0xe02410, r=0x1134c20, a=0x7fffb4afd3f0, ret=0x0) at /usr/include/x86_64-linux-gnu/qt5/QtCore/qobject_impl.h:143 #22 0x00007ffff5567dca in QObject::event(QEvent*) () from /usr/lib/x86_64-linux-gnu/libQt5Core.so.5 #23 0x00007ffff5e41adc in QApplicationPrivate::notify_helper(QObject*, QEvent*) () from /usr/lib/x86_64-linux-gnu/libQt5Widgets.so.5 #24 0x00007ffff5e46fb0 in QApplication::notify(QObject*, QEvent*) () from /usr/lib/x86_64-linux-gnu/libQt5Widgets.so.5 #25 0x00007ffff55362eb in QCoreApplication::notifyInternal(QObject*, QEvent*) () from /usr/lib/x86_64-linux-gnu/libQt5Core.so.5 #26 0x00007ffff553835b in QCoreApplicationPrivate::sendPostedEvents(QObject*, int, QThreadData*) () from /usr/lib/x86_64-linux-gnu/libQt5Core.so.5 #27 0x00007ffff558eeb3 in ?? () from /usr/lib/x86_64-linux-gnu/libQt5Core.so.5 #28 0x00007fffedb58cfd in g_main_context_dispatch () from /lib/x86_64-linux-gnu/libglib-2.0.so.0 #29 0x00007fffedb58fe0 in ?? () from /lib/x86_64-linux-gnu/libglib-2.0.so.0 #30 0x00007fffedb5908c in g_main_context_iteration () from /lib/x86_64-linux-gnu/libglib-2.0.so.0 #31 0x00007ffff558f2c7 in QEventDispatcherGlib::processEvents(QFlags<QEventLoop::ProcessEventsFlag>) () from /usr/lib/x86_64-linux-gnu/libQt5Core.so.5 #32 0x00007ffff5533aa2 in QEventLoop::exec(QFlags<QEventLoop::ProcessEventsFlag>) () from /usr/lib/x86_64-linux-gnu/libQt5Core.so.5 #33 0x00007ffff553b6ec in QCoreApplication::exec() () from /usr/lib/x86_64-linux-gnu/libQt5Core.so.5 #34 0x0000000000418656 in main (argc=3, argv=0x7fffffffdef8) at /home/blackjack/projects/other/kdevelop/app/main.cpp:618 auto is deduced not to QString but to QStringBuilder instead, that holds a reference to some temporary data. When you explicitly cast it to QString the error goes away.
Created attachment 93774 [details] Updated patch Updated patch - similar issue in another place
Git commit cb348e381c6d3dc97c2436ed10bd9d4588d3bc92 by Kevin Funk, on behalf of Oleksandr Senkovych. Committed on 28/07/2015 at 11:06. Pushed by kfunk into branch 'master'. Fix crash when auto is deduced to QStringBuilder In this case 'auto' is deduced to QStringBuilder instead of QString (b/c of QT_FAST_OPERATOR_PLUS we've just enabled). QStringBuilder holds temporary data which is accessed when this object is finally converted to a proper QString later on. => Crash M +2 -2 duchain/unknowndeclarationproblem.cpp http://commits.kde.org/kdev-clang/cb348e381c6d3dc97c2436ed10bd9d4588d3bc92
Pushed. Note: Please use 'git format-patch' next time, so the author information is stored inside the patch => Makes my job easier. Thanks again!