Bug 362515

Summary: Segfault in code completion
Product: [Developer tools] kdev-python Reporter: Francis Herne <mail>
Component: Code completionAssignee: Sven Brauch <mail>
Status: RESOLVED FIXED    
Severity: crash    
Priority: NOR    
Version First Reported In: unspecified   
Target Milestone: 1.7.3   
Platform: Compiled Sources   
OS: Linux   
Latest Commit: Version Fixed In:
Sentry Crash Report:

Description Francis Herne 2016-04-30 20:25:22 UTC
Built from 5.0 branch as of 10th March, on Arch Linux. KDevelop and KDevPlatform ditto.

Code being edited:
===
...
class EntityNetwork(dict):
    @classmethod
    def from_file(cls, filename):
        file = open(fi)  <<<<<< partway through typing 'filename'.
        
Backtrace:
====
Thread 9 "KDevelop::Compl" received signal SIGSEGV, Segmentation fault.
[Switching to Thread 0x7fffa3477700 (LWP 3100)]
0x00007fffa3735f16 in Python::PythonCodeCompletionContext::PythonCodeCompletionContext (this=0x7fff9c00b980, context=..., text=..., followingText=..., position=..., depth=<optimized out>)
    at /tmp/yaourt-tmp-flh/aur-kdevelop-python3-git/src/kdev-python/codecompletion/context.cpp:1033
1033    /tmp/yaourt-tmp-flh/aur-kdevelop-python3-git/src/kdev-python/codecompletion/context.cpp: No such file or directory.
(gdb) bt full
#0  0x00007fffa3735f16 in Python::PythonCodeCompletionContext::PythonCodeCompletionContext (this=0x7fff9c00b980, context=..., text=..., followingText=..., position=..., depth=<optimized out>)
    at /tmp/yaourt-tmp-flh/aur-kdevelop-python3-git/src/kdev-python/codecompletion/context.cpp:1033
        location = <optimized out>
        parser = {m_code = {static null = {<No data fields>}, d = 0xb8}, m_cursorPositionInString = 224}
        firstStatus = <optimized out>
        currentlyCheckedLine = <optimized out>
        from = <optimized out>
        importIndex = <optimized out>
        beforeAndAfterCursor = {first = {static null = {<No data fields>}, d = 0x1c}, second = {static null = {<No data fields>}, d = 0x60000000c}}
        indents = {m_indents = {<QListSpecialMethods<int>> = {<No data fields>}, {p = {static shared_null = {ref = {atomic = {_q_value = {<std::__atomic_base<int>> = {static _S_alignment = 4,
                          _M_i = -1}, <No data fields>}}}, alloc = 0, begin = 0, end = 0, array = {0x0}}, d = 0x7fffa3476500}, d = 0x7fffa3476500}}}
        currentlyChecked = <optimized out>
        defKeywords = {<QListSpecialMethods<Python::ExpressionParser::Status>> = {<No data fields>}, {p = {static shared_null = {ref = {atomic = {_q_value = {<std::__atomic_base<int>> = {static _S_alignment = 4,
                        _M_i = -1}, <No data fields>}}}, alloc = 0, begin = 0, end = 0, array = {0x0}}, d = 0x7fffa34765d0}, d = 0x7fffa34765d0}}
        import = <optimized out>
        fromIndex = <optimized out>
        textWithoutStrings = {static null = {<No data fields>}, d = 0x18}
        allExpressions = {<QList<Python::TokenListEntry>> = {<QListSpecialMethods<Python::TokenListEntry>> = {<No data fields>}, {p = {static shared_null = {ref = {atomic = {_q_value = {<std::__atomic_base<int>> = {
                          static _S_alignment = 4, _M_i = -1}, <No data fields>}}}, alloc = 0, begin = 0, end = 0, array = {0x0}}, d = 0x3}, d = 0x3}}, m_internalPtr = 12}
        __PRETTY_FUNCTION__ = "Python::PythonCodeCompletionContext::PythonCodeCompletionContext(KDevelop::DUContextPointer, const QString&, const QString&, const KDevelop::CursorInRevision&, int, const Python::PythonCodeCompletionW"...
#1  0x00007fffa373bc07 in Python::PythonCodeCompletionWorker::createCompletionContext (this=0x45944c0, context=..., contextText=..., followingText=..., position=...)
    at /tmp/yaourt-tmp-flh/aur-kdevelop-python3-git/src/kdev-python/codecompletion/worker.cpp:47
        completionContext = <optimized out>
#2  0x00007ffff24090d0 in KDevelop::CodeCompletionWorker::computeCompletions (this=0x45944c0, context=..., position=..., followingText=..., contextRange=..., contextText=...)
    at /home/flh/projects/src/kdevplatform/language/codecompletion/codecompletionworker.cpp:153
        __PRETTY_FUNCTION__ = "virtual void KDevelop::CodeCompletionWorker::computeCompletions(KDevelop::DUContextPointer, const KTextEditor::Cursor&, QString, const KTextEditor::Range&, const QString&)"
        completionContext = {d = 0x4ca22f0}
#3  0x00007ffff2408772 in KDevelop::CodeCompletionWorker::computeCompletions (this=0x45944c0, context=..., position=..., view=0x4abbe10)
    at /home/flh/projects/src/kdevplatform/language/codecompletion/codecompletionworker.cpp:129
        foreground = {m_locked = false}
        doc = 0x4ca22f0
        __PRETTY_FUNCTION__ = "void KDevelop::CodeCompletionWorker::computeCompletions(KDevelop::DUContextPointer, const KTextEditor::Cursor&, KTextEditor::View*)"
        range = {m_start = {m_line = 67, m_column = 0}, m_end = {m_line = 67, m_column = 20}}
        text = {static null = {<No data fields>}, d = 0x7fff9c00c5a0}
        cursorPosition = {m_line = 67, m_column = 21}
        followingText = {static null = {<No data fields>}, d = 0x7fff9c008200}
#4  0x00007ffff240f232 in QtPrivate::FunctorCall<QtPrivate::IndexesList<0, 1, 2>, QtPrivate::List<KDevelop::DUChainPointer<KDevelop::DUContext>, KTextEditor::Cursor const&, KTextEditor::View*>, void, void (KDevelop::CodeCompletionWorker::*)(KDevelop::DUChainPointer<KDevelop::DUContext>, KTextEditor::Cursor const&, KTextEditor::View*)>::call (arg=<optimized out>, o=<optimized out>, f=<optimized out>)
    at /usr/include/qt/QtCore/qobjectdefs_impl.h:501
No locals.
#5  QtPrivate::FunctionPointer<void (KDevelop::CodeCompletionWorker::*)(KDevelop::DUChainPointer<KDevelop::DUContext>, KTextEditor::Cursor const&, KTextEditor::View*)>::call<QtPrivate::List<KDevelop::DUChainPointer<KDevelop::DUContext>, KTextEditor::Cursor const&, KTextEditor::View*>, void> (arg=<optimized out>, o=<optimized out>, f=<optimized out>) at /usr/include/qt/QtCore/qobjectdefs_impl.h:520
No locals.
#6  QtPrivate::QSlotObject<void (KDevelop::CodeCompletionWorker::*)(KDevelop::DUChainPointer<KDevelop::DUContext>, KTextEditor::Cursor const&, KTextEditor::View*), QtPrivate::List<KDevelop::DUChainPointer<KDevelop::DUContext>, KTextEditor::Cursor const&, KTextEditor::View*>, void>::impl (which=<optimized out>, this_=<optimized out>, r=<optimized out>, a=<optimized out>, ret=<optimized out>) at /usr/include/qt/QtCore/qobject_impl.h:143

Reproducible: Didn't try

Steps to Reproduce:
Not really sure. Happened (probably) twice, not doing obviously the same thing.

Actual Results:  
Crash!

Expected Results:  
Not a crash!
Comment 1 Francis Herne 2016-05-01 00:04:04 UTC
Crashed again, backtrace looks a bit different:
Thread 9 "KDevelop::Compl" received signal SIGSEGV, Segmentation fault.
[Switching to Thread 0x7fffa3477700 (LWP 13580)]
KDevelop::DUChainBase::rangeInCurrentRevision (this=0x0) at /home/flh/projects/src/kdevplatform/language/duchain/duchainbase.cpp:157
157         DocumentChangeTracker* tracker = ICore::self()->languageController()->backgroundParser()->trackerForUrl(url());
(gdb) bt full
#0  KDevelop::DUChainBase::rangeInCurrentRevision (this=0x0) at /home/flh/projects/src/kdevplatform/language/duchain/duchainbase.cpp:157
        tracker = <optimized out>
#1  0x00007fffa373be72 in Python::PythonCodeCompletionWorker::updateContextRange (this=<optimized out>, contextRange=..., view=<optimized out>, context=...)
    at /tmp/yaourt-tmp-flh/aur-kdevelop-python3-git/src/kdev-python/codecompletion/worker.cpp:59
        __PRETTY_FUNCTION__ = "virtual void Python::PythonCodeCompletionWorker::updateContextRange(KTextEditor::Range&, KTextEditor::View*, KDevelop::DUContextPointer) const"
#2  0x00007ffff240881f in KDevelop::CodeCompletionWorker::computeCompletions (this=0x45745e0, context=..., position=..., view=0x48111b0)
    at /home/flh/projects/src/kdevplatform/language/codecompletion/codecompletionworker.cpp:108
        lock = {val = 72823617}
        lockDUChain = {m_lock = 0x7ffff2afbba0 <KDevelop::(anonymous namespace)::Q_QGS_sdDUChainPrivate::innerFunction()::holder+32>, m_locked = true, m_timeout = 0}
        foreground = {m_locked = true}
        doc = 0x4815ea0
        __PRETTY_FUNCTION__ = "void KDevelop::CodeCompletionWorker::computeCompletions(KDevelop::DUContextPointer, const KTextEditor::Cursor&, KTextEditor::View*)"
        range = {m_start = {m_line = 67, m_column = 0}, m_end = {m_line = 67, m_column = 45}}
        text = {static null = {<No data fields>}, d = 0x7ffff4dc7ee0 <QArrayData::shared_null>}
        cursorPosition = {m_line = -223364192, m_column = 32767}
        followingText = <optimized out>
#3  0x00007ffff240f232 in QtPrivate::FunctorCall<QtPrivate::IndexesList<0, 1, 2>, QtPrivate::List<KDevelop::DUChainPointer<KDevelop::DUContext>, KTextEditor::Cursor const&, KTextEditor::View*>, void, void (KDevelop::CodeCompletionWorker::*)(KDevelop::DUChainPointer<KDevelop::DUContext>, KTextEditor::Cursor const&, KTextEditor::View*)>::call (arg=<optimized out>, o=<optimized out>, f=<optimized out>)
    at /usr/include/qt/QtCore/qobjectdefs_impl.h:501
No locals.
#4  QtPrivate::FunctionPointer<void (KDevelop::CodeCompletionWorker::*)(KDevelop::DUChainPointer<KDevelop::DUContext>, KTextEditor::Cursor const&, KTextEditor::View*)>::call<QtPrivate::List<KDevelop::DUChainPointer<KDevelop::DUContext>, KTextEditor::Cursor const&, KTextEditor::View*>, void> (arg=<optimized out>, o=<optimized out>, f=<optimized out>) at /usr/include/qt/QtCore/qobjectdefs_impl.h:520
No locals.
#5  QtPrivate::QSlotObject<void (KDevelop::CodeCompletionWorker::*)(KDevelop::DUChainPointer<KDevelop::DUContext>, KTextEditor::Cursor const&, KTextEditor::View*), QtPrivate::List<KDevelop::DUChainPointer<KDevelop::DUContext>, KTextEditor::Cursor const&, KTextEditor::View*>, void>::impl (which=<optimized out>, this_=<optimized out>, r=<optimized out>, a=<optimized out>, ret=<optimized out>) at /usr/include/qt/QtCore/qobject_impl.h:143
No locals.
#6  0x00007ffff4d47659 in QObject::event(QEvent*) () from /usr/lib/libQt5Core.so.5
No symbol table info available.
#7  0x00007ffff5a3e68c in QApplicationPrivate::notify_helper(QObject*, QEvent*) () from /usr/lib/libQt5Widgets.so.5
No symbol table info available.
#8  0x00007ffff5a438f6 in QApplication::notify(QObject*, QEvent*) () from /usr/lib/libQt5Widgets.so.5
No symbol table info available.
#9  0x00007ffff4d1a518 in QCoreApplication::notifyInternal2(QObject*, QEvent*) () from /usr/lib/libQt5Core.so.5
No symbol table info available.
#10 0x00007ffff4d1c3da in QCoreApplicationPrivate::sendPostedEvents(QObject*, int, QThreadData*) () from /usr/lib/libQt5Core.so.5
No symbol table info available.
#11 0x00007ffff4d6f883 in ?? () from /usr/lib/libQt5Core.so.5
No symbol table info available.
#12 0x00007fffec105f07 in g_main_context_dispatch () from /usr/lib/libglib-2.0.so.0
No symbol table info available.
#13 0x00007fffec106160 in ?? () from /usr/lib/libglib-2.0.so.0
No symbol table info available.
#14 0x00007fffec10620c in g_main_context_iteration () from /usr/lib/libglib-2.0.so.0
No symbol table info available.
#15 0x00007ffff4d6fc8f in QEventDispatcherGlib::processEvents(QFlags<QEventLoop::ProcessEventsFlag>) () from /usr/lib/libQt5Core.so.5
No symbol table info available.
#16 0x00007ffff4d186fa in QEventLoop::exec(QFlags<QEventLoop::ProcessEventsFlag>) () from /usr/lib/libQt5Core.so.5
No symbol table info available.
#17 0x00007ffff4b41fe4 in QThread::exec() () from /usr/lib/libQt5Core.so.5
No symbol table info available.
#18 0x00007ffff2411964 in KDevelop::CompletionWorkerThread::run (this=0x4574350) at /home/flh/projects/src/kdevplatform/language/codecompletion/codecompletionmodel.cpp:89
No locals.
#19 0x00007ffff4b46de8 in ?? () from /usr/lib/libQt5Core.so.5
No symbol table info available.
#20 0x00007fffecc93424 in start_thread () from /usr/lib/libpthread.so.0
No symbol table info available.
#21 0x00007ffff4460cbd in clone () from /usr/lib/libc.so.6
Comment 2 Sven Brauch 2016-05-01 09:10:42 UTC
Yes, different trace, but the same issue I think: the context passed to the completion worker is null, and I wasn't aware that is possible. I wonder if that changed recently, I need to investigate.
Comment 3 Sven Brauch 2016-05-01 12:04:54 UTC
Might be the same issue, I hit that two days ago myself:

Thread 12 "KDevelop::Compl" received signal SIGSEGV, Segmentation fault.
[Switching to Thread 0x7fffd10c6700 (LWP 11166)]
0x00007fffc18177bc in 
Python::Helper::declarationForName(KDevelop::QualifiedIdentifier const&, 
KDevelop::RangeInRevision const&, KDevelop::DUChainPointer<KDevelop::DUContext 
const>) () from /home/sven/install/lib64/libkdevpythonduchain.so
(gdb) bt
#0  0x00007fffc18177bc in 
Python::Helper::declarationForName(KDevelop::QualifiedIdentifier const&, 
KDevelop::RangeInRevision const&, KDevelop::DUChainPointer<KDevelop::DUContext 
const>) () from /home/sven/install/lib64/libkdevpythonduchain.so
#1  0x00007fffc180cd98 in Python::ExpressionVisitor::visitName(Python::NameAst*) 
() from /home/sven/install/lib64/libkdevpythonduchain.so
#2  0x00007fffa94167c2 in Python::AstVisitor::visitNode(Python::Ast*) () from 
/home/sven/install/lib64/libkdevpythonparser.so
#3  0x00007fffa9410748 in 
Python::AstDefaultVisitor::visitExpression(Python::ExpressionAst*) () from 
/home/sven/install/lib64/libkdevpythonparser.so
#4  0x00007fffa9416a59 in Python::AstVisitor::visitNode(Python::Ast*) () from 
/home/sven/install/lib64/libkdevpythonparser.so
#5  0x00007fffa94106bb in Python::AstDefaultVisitor::visitCode(Python::CodeAst*) 
() from /home/sven/install/lib64/libkdevpythonparser.so
#6  0x00007fffd180ca52 in Python::visitorForString(QString, 
KDevelop::DUContext*, KDevelop::CursorInRevision) () from 
/home/sven/install/lib64/libkdevpythoncompletion.so
#7  0x00007fffd180f12a in 
Python::PythonCodeCompletionContext::memberAccessItems() () from 
/home/sven/install/lib64/libkdevpythoncompletion.so
#8  0x00007fffd1811eda in 
Python::PythonCodeCompletionContext::completionItems(bool&, bool) () from 
/home/sven/install/lib64/libkdevpythoncompletion.so
#9  0x00007fffedc4145b in 
KDevelop::CodeCompletionWorker::computeCompletions(KDevelop::DUChainPointer<KDevelop::DUContext>, 
KTextEditor::Cursor const&, QString, KTextEditor::Range const&, QString const&) 
() from /home/sven/install/lib64/libKDevPlatformLanguage.so.10
#10 0x00007fffedc41039 in 
KDevelop::CodeCompletionWorker::computeCompletions(KDevelop::DUChainPointer<KDevelop::DUContext>, 
KTextEditor::Cursor const&, KTextEditor::View*) () from 
/home/sven/install/lib64/libKDevPlatformLanguage.so.10
#11 0x00007fffedc48920 in QtPrivate::FunctorCall<QtPrivate::IndexesList<0, 1, 
2>, QtPrivate::List<KDevelop::DUChainPointer<KDevelop::DUContext>, 
KTextEditor::Cursor const&, KTextEditor::View*>, void, void 
(KDevelop::CodeCompletionWorker::*)(KDevelop::DUChainPointer<KDevelop::DUContext>, 
KTextEditor::Cursor const&, KTextEditor::View*)>::call(void 
(KDevelop::CodeCompletionWorker::*)(KDevelop::DUChainPointer<KDevelop::DUContext>, 
KTextEditor::Cursor const&, KTextEditor::View*), 
KDevelop::CodeCompletionWorker*, void**) ()
    from /home/sven/install/lib64/libKDevPlatformLanguage.so.10
#12 0x00007fffedc483c9 in void QtPrivate::FunctionPointer<void 
(KDevelop::CodeCompletionWorker::*)(KDevelop::DUChainPointer<KDevelop::DUContext>, 
KTextEditor::Cursor const&, 
KTextEditor::View*)>::call<QtPrivate::List<KDevelop::DUChainPointer<KDevelop::DUContext>, 
KTextEditor::Cursor const&, KTextEditor::View*>, void>(void 
(KDevelop::CodeCompletionWorker::*)(KDevelop::DUChainPointer<KDevelop::DUContext>, 
KTextEditor::Cursor const&, KTextEditor::View*), 
KDevelop::CodeCompletionWorker*, void**) ()
    from /home/sven/install/lib64/libKDevPlatformLanguage.so.10
#13 0x00007fffedc47db9 in QtPrivate::QSlotObject<void 
(KDevelop::CodeCompletionWorker::*)(KDevelop::DUChainPointer<KDevelop::DUContext>, 
KTextEditor::Cursor const&, KTextEditor::View*), 
QtPrivate::List<KDevelop::DUChainPointer<KDevelop::DUContext>, 
KTextEditor::Cursor const&, KTextEditor::View*>, void>::impl(int, 
QtPrivate::QSlotObjectBase*, QObject*, void**, bool*) () from 
/home/sven/install/lib64/libKDevPlatformLanguage.so.10
#14 0x00007ffff0af2659 in QObject::event(QEvent*) () from /usr/lib/libQt5Core.so.5
#15 0x00007ffff17e968c in QApplicationPrivate::notify_helper(QObject*, QEvent*) 
() from /usr/lib/libQt5Widgets.so.5
#16 0x00007ffff17ee8f6 in QApplication::notify(QObject*, QEvent*) () from 
/usr/lib/libQt5Widgets.so.5
#17 0x00007ffff0ac5518 in QCoreApplication::notifyInternal2(QObject*, QEvent*) 
() from /usr/lib/libQt5Core.so.5
#18 0x00007ffff0ac73da in QCoreApplicationPrivate::sendPostedEvents(QObject*, 
int, QThreadData*) () from /usr/lib/libQt5Core.so.5
#19 0x00007ffff0b1a883 in ?? () from /usr/lib/libQt5Core.so.5
#20 0x00007fffe6240f07 in g_main_context_dispatch () from /usr/lib/libglib-2.0.so.0
#21 0x00007fffe6241160 in ?? () from /usr/lib/libglib-2.0.so.0
#22 0x00007fffe624120c in g_main_context_iteration () from /usr/lib/libglib-2.0.so.0
#23 0x00007ffff0b1ac8f in 
QEventDispatcherGlib::processEvents(QFlags<QEventLoop::ProcessEventsFlag>) () 
from /usr/lib/libQt5Core.so.5
#24 0x00007ffff0ac36fa in 
QEventLoop::exec(QFlags<QEventLoop::ProcessEventsFlag>) () from 
/usr/lib/libQt5Core.so.5
---Type <return> to continue, or q <return> to quit---
#25 0x00007ffff08ecfe4 in QThread::exec() () from /usr/lib/libQt5Core.so.5
#26 0x00007fffedc46853 in KDevelop::CompletionWorkerThread::run() () from 
/home/sven/install/lib64/libKDevPlatformLanguage.so.10
#27 0x00007ffff08f1de8 in ?? () from /usr/lib/libQt5Core.so.5
#28 0x00007fffe8b82424 in start_thread () from /usr/lib/libpthread.so.0
#29 0x00007fffefcf0cbd in clone () from /usr/lib/libc.so.6

Waiting for it to happen again now with a debug build.
Comment 4 Francis Herne 2016-05-02 22:46:44 UTC
More backtrace:

----
Thread 9 "KDevelop::Compl" received signal SIGSEGV, Segmentation fault.
[Switching to Thread 0x7fffa59be700 (LWP 13247)]
0x00007fff88056020 in ?? ()
(gdb) bt full
#0  0x00007fff88056020 in ?? ()
No symbol table info available.
#1  0x00007fffa5a0081f in Python::ExpressionVisitor::ExpressionVisitor (this=0x7fffa0040c60, ctx=<optimized out>) at /tmp/yaourt-tmp-flh/aur-kdevelop-python3-git/src/kdev-python/duchain/expressionvisitor.cpp:70
No locals.
#2  0x00007fffa5c73969 in Python::visitorForString (str=..., context=context@entry=0x7fff880b2240, scanUntil=..., scanUntil@entry=...)
    at /tmp/yaourt-tmp-flh/aur-kdevelop-python3-git/src/kdev-python/codecompletion/context.cpp:84
        builder = {m_problems = {<QListSpecialMethods<QExplicitlySharedDataPointer<KDevelop::Problem> >> = {<No data fields>}, {p = {static shared_null = {ref = {atomic = {_q_value = {<std::__atomic_base<int>> = {
                          static _S_alignment = 4, _M_i = -1}, <No data fields>}}}, alloc = 0, begin = 0, end = 0, array = {0x0}}, d = 0x7ffff4dc9d40 <QListData::shared_null>}, d = 0x7ffff4dc9d40 <QListData::shared_null>}}, 
          static pyInitLock = {<QBasicMutex> = {d_ptr = {_q_value = {_M_b = {_M_p = 0x0}}}}, <No data fields>}}
        tmpAst = {value = 0x7fffa0051e50, d = 0x7fffa008e580}
        v = <optimized out>
#3  0x00007fffa5c77947 in Python::PythonCodeCompletionContext::functionCallItems (this=this@entry=0x7fffa0043080) at /tmp/yaourt-tmp-flh/aur-kdevelop-python3-git/src/kdev-python/codecompletion/context.cpp:144
        resultingItems = {<QListSpecialMethods<QExplicitlySharedDataPointer<KDevelop::CompletionTreeItem> >> = {<No data fields>}, {p = {static shared_null = {ref = {atomic = {_q_value = {<std::__atomic_base<int>> = {
                        static _S_alignment = 4, _M_i = -1}, <No data fields>}}}, alloc = 0, begin = 0, end = 0, array = {0x0}}, d = 0x7ffff4dc9d40 <QListData::shared_null>}, d = 0x7ffff4dc9d40 <QListData::shared_null>}}
        functionCalled = 0x0
        v = std::unique_ptr<Python::ExpressionVisitor> containing 0x7ffff4dc7ee0 <QArrayData::shared_null>
        lock = {m_lock = 0x7ffff4dc7ee0 <QArrayData::shared_null>, m_locked = 89, m_timeout = 32767}
        __PRETTY_FUNCTION__ = "Python::PythonCodeCompletionContext::ItemList Python::PythonCodeCompletionContext::functionCallItems()"
        current = 0x7ffff4dc9d40 <QListData::shared_null>
        calltips = {<QListSpecialMethods<KDevelop::Declaration*>> = {<No data fields>}, {p = {static shared_null = {ref = {atomic = {_q_value = {<std::__atomic_base<int>> = {static _S_alignment = 4, 
                        _M_i = -1}, <No data fields>}}}, alloc = 0, begin = 0, end = 0, array = {0x0}}, d = 0x7ffff4dc9d40 <QListData::shared_null>}, d = 0x7ffff4dc9d40 <QListData::shared_null>}}
        calltipItems = {<QListSpecialMethods<QExplicitlySharedDataPointer<KDevelop::CompletionTreeItem> >> = {<No data fields>}, {p = {static shared_null = {ref = {atomic = {_q_value = {<std::__atomic_base<int>> = {
                        static _S_alignment = 4, _M_i = -1}, <No data fields>}}}, alloc = 0, begin = 0, end = 0, array = {0x0}}, d = 0x7ffff4dc9d40 <QListData::shared_null>}, d = 0x7ffff4dc9d40 <QListData::shared_null>}}
#4  0x00007fffa5c7cb28 in Python::PythonCodeCompletionContext::completionItems (this=0x7fffa0043080, abort=@0x42aa2d0: false, fullCompletion=<optimized out>)
    at /tmp/yaourt-tmp-flh/aur-kdevelop-python3-git/src/kdev-python/codecompletion/context.cpp:574
        resultingItems = {<QListSpecialMethods<QExplicitlySharedDataPointer<KDevelop::CompletionTreeItem> >> = {<No data fields>}, {p = {static shared_null = {ref = {atomic = {_q_value = {<std::__atomic_base<int>> = {
                        static _S_alignment = 4, _M_i = -1}, <No data fields>}}}, alloc = 0, begin = 0, end = 0, array = {0x0}}, d = 0x7ffff4dc9d40 <QListData::shared_null>}, d = 0x7ffff4dc9d40 <QListData::shared_null>}}
        __PRETTY_FUNCTION__ = "virtual QList<QExplicitlySharedDataPointer<KDevelop::CompletionTreeItem> > Python::PythonCodeCompletionContext::completionItems(bool&, bool)"
#5  0x00007fffa5c7c992 in Python::PythonCodeCompletionContext::completionItems (this=this@entry=0x7fffa003bf20, abort=@0x42aa2d0: false, fullCompletion=fullCompletion@entry=false)
    at /tmp/yaourt-tmp-flh/aur-kdevelop-python3-git/src/kdev-python/codecompletion/context.cpp:564
        resultingItems = {<QListSpecialMethods<QExplicitlySharedDataPointer<KDevelop::CompletionTreeItem> >> = {<No data fields>}, {p = {static shared_null = {ref = {atomic = {_q_value = {<std::__atomic_base<int>> = {
                        static _S_alignment = 4, _M_i = -1}, <No data fields>}}}, alloc = 0, begin = 0, end = 0, array = {0x0}}, d = 0x7ffff4dc9d40 <QListData::shared_null>}, d = 0x7ffff4dc9d40 <QListData::shared_null>}}
        __PRETTY_FUNCTION__ = "virtual QList<QExplicitlySharedDataPointer<KDevelop::CompletionTreeItem> > Python::PythonCodeCompletionContext::completionItems(bool&, bool)"
#6  0x00007ffff2408d24 in KDevelop::CodeCompletionWorker::computeCompletions (this=0x42aa2b0, context=..., position=..., followingText=..., contextRange=..., contextText=...)
    at /home/flh/projects/src/kdevplatform/language/codecompletion/codecompletionworker.cpp:167
        items = {<QListSpecialMethods<QExplicitlySharedDataPointer<KDevelop::CompletionTreeItem> >> = {<No data fields>}, {p = {static shared_null = {ref = {atomic = {_q_value = {<std::__atomic_base<int>> = {
                        static _S_alignment = 4, _M_i = -1}, <No data fields>}}}, alloc = 0, begin = 0, end = 0, array = {0x0}}, d = 0x2a21aa0}, d = 0x2a21aa0}}
        tree = {<QListSpecialMethods<QExplicitlySharedDataPointer<KDevelop::CompletionTreeElement> >> = {<No data fields>}, {p = {static shared_null = {ref = {atomic = {_q_value = {<std::__atomic_base<int>> = {
                        static _S_alignment = 4, _M_i = -1}, <No data fields>}}}, alloc = 0, begin = 0, end = 0, array = {0x0}}, d = 0x7ffff4dc7ee0 <QArrayData::shared_null>}, d = 0x7ffff4dc7ee0 <QArrayData::shared_null>}}
        __PRETTY_FUNCTION__ = "virtual void KDevelop::CodeCompletionWorker::computeCompletions(KDevelop::DUContextPointer, const KTextEditor::Cursor&, QString, const KTextEditor::Range&, const QString&)"
        completionContext = {d = 0x7fffa003bf20}
#7  0x00007ffff2408772 in KDevelop::CodeCompletionWorker::computeCompletions (this=0x42aa2b0, context=..., position=..., view=0x4396780)
    at /home/flh/projects/src/kdevplatform/language/codecompletion/codecompletionworker.cpp:129
        foreground = {m_locked = false}
        doc = 0x42a5e70
        __PRETTY_FUNCTION__ = "void KDevelop::CodeCompletionWorker::computeCompletions(KDevelop::DUContextPointer, const KTextEditor::Cursor&, KTextEditor::View*)"
        range = {m_start = {m_line = 26, m_column = 0}, m_end = {m_line = 27, m_column = 22}}
        text = {static null = {<No data fields>}, d = 0x7fffa005e930}
        cursorPosition = {m_line = 27, m_column = 23}
        followingText = {static null = {<No data fields>}, d = 0x7fffa0004c60}
#8  0x00007ffff240f232 in QtPrivate::FunctorCall<QtPrivate::IndexesList<0, 1, 2>, QtPrivate::List<KDevelop::DUChainPointer<KDevelop::DUContext>, KTextEditor::Cursor const&, KTextEditor::View*>, void, void (KDevelop::CodeCompletionWorker::*)(KDevelop::DUChainPointer<KDevelop::DUContext>, KTextEditor::Cursor const&, KTextEditor::View*)>::call (arg=<optimized out>, o=<optimized out>, f=<optimized out>)
    at /usr/include/qt/QtCore/qobjectdefs_impl.h:501
No locals.
#9  QtPrivate::FunctionPointer<void (KDevelop::CodeCompletionWorker::*)(KDevelop::DUChainPointer<KDevelop::DUContext>, KTextEditor::Cursor const&, KTextEditor::View*)>::call<QtPrivate::List<KDevelop::DUChainPointer<KDevelop::DUContext>, KTextEditor::Cursor const&, KTextEditor::View*>, void> (arg=<optimized out>, o=<optimized out>, f=<optimized out>) at /usr/include/qt/QtCore/qobjectdefs_impl.h:520
No locals.
---Type <return> to continue, or q <return> to quit---
#10 QtPrivate::QSlotObject<void (KDevelop::CodeCompletionWorker::*)(KDevelop::DUChainPointer<KDevelop::DUContext>, KTextEditor::Cursor const&, KTextEditor::View*), QtPrivate::List<KDevelop::DUChainPointer<KDevelop::DUContext>, KTextEditor::Cursor const&, KTextEditor::View*>, void>::impl (which=<optimized out>, this_=<optimized out>, r=<optimized out>, a=<optimized out>, ret=<optimized out>) at /usr/include/qt/QtCore/qobject_impl.h:143
No locals.
Comment 5 Sven Brauch 2016-05-02 22:50:19 UTC
It looks a bit like the context gets deleted by something else. I wonder why this started happening only now ...
Comment 6 Sven Brauch 2016-05-11 16:28:31 UTC
Git commit 19c1dc421e8ceaa4ac28663b255578dd006a6dc6 by Sven Brauch.
Committed on 11/05/2016 at 16:27.
Pushed by brauch into branch '5.0'.

Do not create a completion context if the passed DUContext is null.

Not sure when exactly this happens, but it seems to happen.

M  +6    -1    codecompletion/worker.cpp

http://commits.kde.org/kdev-python/19c1dc421e8ceaa4ac28663b255578dd006a6dc6
Comment 7 Sven Brauch 2016-05-11 16:28:54 UTC
This should do, not 100% sure it is the correct fix. Let me know if you still observe the crash.