| Summary: | Autocomplete resource [Python::PythonDeclarationCompletionItem::data] | ||
|---|---|---|---|
| Product: | [Developer tools] kdev-python | Reporter: | Orlando Xavier <orlandoxavier.sh> |
| Component: | Language support | Assignee: | Sven Brauch <mail> |
| Status: | REOPENED --- | ||
| Severity: | crash | CC: | abvit89, apaku, daniel, jonathan.verner |
| Priority: | NOR | ||
| Version First Reported In: | unspecified | ||
| Target Milestone: | 1.4.0 | ||
| Platform: | Mageia RPMs | ||
| OS: | Linux | ||
| Latest Commit: | Version Fixed/Implemented In: | ||
| Sentry Crash Report: | |||
| Attachments: |
A patch that seems to fix the crash
New crash information added by DrKonqi |
||
|
Description
Orlando Xavier
2013-01-31 21:31:50 UTC
Please install debug symbols for kdevelop/kdevplatform. I suspect the backtrace is useless as-is. That looks difficult to fux without being able to reproduce it myself. Can you describe in more detail what you were doing to make this happen? Especially, the file being edited and the location in the file being edited would be useful. Greetings Created attachment 77084 [details]
A patch that seems to fix the crash
I've had the same crash, so I tried to debug this - I've rearranged the code a bit to debug it better, but that seemed to fix the crash - and I am yet to understand why. You can apply this patch as a workaround though...
Please disregard the patch - by mistake I've made the comparison to be always true. (In reply to comment #3) > Created attachment 77084 [details] > A patch that seems to fix the crash > > I've had the same crash, so I tried to debug this - I've rearranged the code > a bit to debug it better, but that seemed to fix the crash - and I am yet to > understand why. You can apply this patch as a workaround though... Oh sorry, I totally overlooked that patch. Did you find out anything about how to reproduce (or even fix) the crash? I can reproduce the crash - it seems to happen when I try to enter some unknown identifier in a deeply nested list comprehension. I have a core dump, and I can debug the core file in kdevelop itself. The crash happens on this line in declaration.cpp:
if ( model->completionContext()->duContext()->topContext() == declaration()->context()->topContext() ) {
When I split the 2 parts of the comparison, the crash does not reproduce, like this:
TopDUContext* modelComplTopContext = model->completionContext()->duContext()->topContext();
TopDUContext* declTopContext = declaration()->context()->topContext();
if ( modelComplTopContext == declTopContext ) {
(In reply to comment #5)
> Oh sorry, I totally overlooked that patch. Did you find out anything about
> how to reproduce (or even fix) the crash?
Hey, if you could send me the file where the crash happens and tell me where to type what, I might be able to reproduce the crash. Could you do that? Thanks, Sven Unfortunately, I couldn't reproduce it on a simpler project.
But I looked at the core file again today and I think I know why it crashed:
The line it crashed on is this:
if ( model->completionContext()->duContext()->topContext() == declaration()->context()->topContext() ) {
Now, looking at the variables from the core at this frame:
model->m_completionContext->d->m_duContext->d->d->m_base is 0x0
But this is what should be returned by
model->completionContext()->duContext()
So topContext() gets called next on NULL pointer.
The code that it crashes on looks something like this:
def _doSomething(self):
_logger.info("doing something")
runMultipleOperations([
otherpkg.newFooOperation(self.bar)
for thing in self.things.itervalues()])
If I start typing something after itervalues(), it becomes underscored in yellow and after a few more characters it crashes. Again, it only happens in my project, I couldn't reproduce it on something simpler.
Hm. Can't reproduce it with that, as you said... If you manage to construct an example which crashes this, let me know. Other than that... I'll think about it, maybe I can come up with something that fixes it. If not, I'll add a workardound for the next release, but I wouldn't like that. :( *** Bug 316925 has been marked as a duplicate of this bug. *** Reopening because of other duplicate bug report. Pasting backtrace: Thread 1 (Thread 0x7fbe8ccfd780 (LWP 7263)): [KCrash Handler] #6 0x00007fbe75808ea2 in Python::PythonDeclarationCompletionItem::data (this=0x7fbe70081630, index=..., role=<optimized out>, model=0x407db40) at /home/vitalii/kdev-python/codecompletion/items/declaration.cpp:73 #7 0x00007fbe75809711 in Python::FunctionDeclarationCompletionItem::data (this=0x7fbe70081630, index=..., role=34, model=0x407db40) at /home/vitalii/kdev-python/codecompletion/items/functiondeclaration.cpp:120 #8 0x00007fbe98865071 in KDevelop::CodeCompletionModel::data (this=0x407db40, index=..., role=34) at /home/vitalii/kdevplatform/language/codecompletion/codecompletionmodel.cpp:371 #9 0x00007fbe7e848645 in data (arole=34, this=0x7fff183db990) at /usr/include/QtCore/qabstractitemmodel.h:402 #10 KateCompletionModel::contextMatchQuality (this=0x5d1e0a0, source=...) at /usr/src/debug/kate-4.10.0/part/completion/katecompletionmodel.cpp:336 #11 0x00007fbe7e84ce0b in KateCompletionModel::updateBestMatches (this=this@entry=0x5d1e0a0) at /usr/src/debug/kate-4.10.0/part/completion/katecompletionmodel.cpp:2034 #12 0x00007fbe7e84d887 in KateCompletionModel::setCurrentCompletion (this=0x5d1e0a0, model=0x3c4a830, completion=...) at /usr/src/debug/kate-4.10.0/part/completion/katecompletionmodel.cpp:954 #13 0x00007fbe7e83fe1b in KateCompletionWidget::cursorPositionChanged (this=0x5d1dd00) at /usr/src/debug/kate-4.10.0/part/completion/katecompletionwidget.cpp:727 #14 0x00007fbe9c4251af in QMetaObject::activate (sender=0x5d936e0, m=<optimized out>, local_signal_index=<optimized out>, argv=0x7fff183dc0e0) at kernel/qobject.cpp:3548 #15 0x00007fbe9ee7eb67 in KTextEditor::View::cursorPositionChanged (this=<optimized out>, _t1=0x5d936e0, _t2=...) at /usr/src/debug/kdelibs-4.10.0/build/interfaces/ktexteditor/view.moc:188 #16 0x00007fbe7e9191fe in KateViewInternal::updateCursor (this=this@entry=0x5d93f20, newCursor=..., force=force@entry=true, center=center@entry=false, calledExternally=calledExternally@entry=false) at /usr/src/debug/kate-4.10.0/part/view/kateviewinternal.cpp:1910 #17 0x00007fbe7e91961f in KateViewInternal::editEnd (this=0x5d93f20, editTagLineStart=<optimized out>, editTagLineEnd=<optimized out>, tagFrom=<optimized out>) at /usr/src/debug/kate-4.10.0/part/view/kateviewinternal.cpp:3372 #18 0x00007fbe7e886242 in editEnd (this=0x4a300d0) at /usr/src/debug/kate-4.10.0/part/document/katedocument.cpp:822 #19 KateDocument::editEnd (this=0x4a300d0) at /usr/src/debug/kate-4.10.0/part/document/katedocument.cpp:797 #20 0x00007fbe7e8885a1 in KateDocument::typeChars (this=0x4a300d0, view=0x5d936e0, realChars=...) at /usr/src/debug/kate-4.10.0/part/document/katedocument.cpp:2599 #21 0x00007fbe7e91e9a8 in keyPressEvent (e=0x7fff183dca60, this=0x5d93f20) at /usr/src/debug/kate-4.10.0/part/view/kateviewinternal.cpp:2402 #22 KateViewInternal::keyPressEvent (this=0x5d93f20, e=0x7fff183dca60) at /usr/src/debug/kate-4.10.0/part/view/kateviewinternal.cpp:2248 #23 0x00007fbe7e9167cd in KateViewInternal::eventFilter (this=0x5d93f20, obj=0x5d93f20, e=0x7fff183dca60) at /usr/src/debug/kate-4.10.0/part/view/kateviewinternal.cpp:2200 #24 0x00007fbe9c40fe06 in QCoreApplicationPrivate::sendThroughObjectEventFilters (this=<optimized out>, receiver=0x5d93f20, event=0x7fff183dca60) at kernel/qcoreapplication.cpp:1056 #25 0x00007fbe9b59d83c in QApplicationPrivate::notify_helper (this=this@entry=0x20cf5a0, receiver=receiver@entry=0x5d93f20, e=e@entry=0x7fff183dca60) at kernel/qapplication.cpp:4558 #26 0x00007fbe9b5a2864 in QApplication::notify (this=<optimized out>, receiver=0x5d93f20, e=0x7fff183dca60) at kernel/qapplication.cpp:4003 #27 0x00007fbe9cc27cb6 in KApplication::notify (this=0x7fff183ddc30, receiver=0x5d93f20, event=0x7fff183dca60) at /usr/src/debug/kdelibs-4.10.0/kdeui/kernel/kapplication.cpp:311 #28 0x00007fbe9c40fc9e in QCoreApplication::notifyInternal (this=0x7fff183ddc30, receiver=0x5d93f20, event=0x7fff183dca60) at kernel/qcoreapplication.cpp:946 #29 0x00007fbe9b639e8a in QKeyMapper::sendKeyEvent (keyWidget=keyWidget@entry=0x5d93f20, grab=grab@entry=false, type=QEvent::KeyPress, code=82, modifiers=..., text=..., autorepeat=autorepeat@entry=false, count=1, nativeScanCode=27, nativeVirtualKey=114, nativeModifiers=16) at kernel/qkeymapper_x11.cpp:1866 #30 0x00007fbe9b63a2c1 in QKeyMapperPrivate::translateKeyEvent (this=0x211da20, keyWidget=0x5d93f20, event=0x7fff183dd480, grab=false) at kernel/qkeymapper_x11.cpp:1836 #31 0x00007fbe9b6179f8 in QApplication::x11ProcessEvent (this=0x7fff183ddc30, event=0x7fff183dd480) at kernel/qapplication_x11.cpp:3543 #32 0x00007fbe9b63dfa2 in x11EventSourceDispatch (s=0x20c7ef0, callback=0x0, user_data=0x0) at kernel/qguieventdispatcher_glib.cpp:146 #33 0x00007fbe947d17d5 in g_main_context_dispatch () from /usr/lib64/libglib-2.0.so.0 #34 0x00007fbe947d1b08 in ?? () from /usr/lib64/libglib-2.0.so.0 #35 0x00007fbe947d1bc4 in g_main_context_iteration () from /usr/lib64/libglib-2.0.so.0 #36 0x00007fbe9c43e1d6 in QEventDispatcherGlib::processEvents (this=0x2034c70, flags=...) at kernel/qeventdispatcher_glib.cpp:424 #37 0x00007fbe9b63dc1e in QGuiEventDispatcherGlib::processEvents (this=<optimized out>, flags=...) at kernel/qguieventdispatcher_glib.cpp:204 #38 0x00007fbe9c40e9ef in QEventLoop::processEvents (this=this@entry=0x7fff183dd850, flags=...) at kernel/qeventloop.cpp:149 #39 0x00007fbe9c40ec78 in QEventLoop::exec (this=0x7fff183dd850, flags=...) at kernel/qeventloop.cpp:204 #40 0x00007fbe9c413918 in QCoreApplication::exec () at kernel/qcoreapplication.cpp:1218 #41 0x000000000040e711 in main (argc=<optimized out>, argv=<optimized out>) at /home/vitalii/kdevelop/app/main.cpp:522 Created attachment 78717 [details]
New crash information added by DrKonqi
kdevelop (4.5.60) on KDE Platform 4.8.4 (4.8.4) using Qt 4.8.2
- What I was doing when the application crashed:
Tried to open the code completion right after typing a few characters. Might have typed another one or two characters with completion open to limit the number of results, not 100% sure about the latter. Can't say wether a parse of the file was still in progress - I did change the scope of a function right before starting to type that functions name.
-- Backtrace (Reduced):
#7 0xe701989c in Python::PythonDeclarationCompletionItem::data (this=0xd828bde8, index=..., role=34, model=0x9d46de0) at /home/andreas/src/kdev-python/codecompletion/items/declaration.cpp:79
#8 0xe701a699 in Python::FunctionDeclarationCompletionItem::data (this=0xd828bde8, index=..., role=34, model=0x9d46de0) at /home/andreas/src/kdev-python/codecompletion/items/functiondeclaration.cpp:117
#9 0xf4bbaaae in KDevelop::CodeCompletionModel::data (this=0x9d46de0, index=..., role=34) at /home/andreas/src/kdevplatform/language/codecompletion/codecompletionmodel.cpp:371
#10 0xe8a24e8e in QModelIndex::data (this=0xffb69e1c, arole=34) at /usr/include/qt4/QtCore/qabstractitemmodel.h:402
#11 0xe8a28ede in KateCompletionModel::contextMatchQuality (this=0x9dec540, source=...) at /home/andreas/src/kate/part/completion/katecompletionmodel.cpp:336
Git commit 01aa82dfbdff19295877729012becdb8615f0d7f by Sven Brauch. Committed on 08/04/2013 at 00:38. Pushed by brauch into branch '1.5'. add an extra safety check in declaration completion item might fix a crash, or not M +1 -0 codecompletion/items/declaration.cpp http://commits.kde.org/kdev-python/01aa82dfbdff19295877729012becdb8615f0d7f Git commit f5353859631f1256112a618b2129c6be1e15ea85 by Sven Brauch. Committed on 08/04/2013 at 00:38. Pushed by brauch into branch 'master'. add an extra safety check in declaration completion item might fix a crash, or not M +1 -0 codecompletion/items/declaration.cpp http://commits.kde.org/kdev-python/f5353859631f1256112a618b2129c6be1e15ea85 Closing as fixed because nobody complained that it's not. Hmm, I hit this crash again today. The (relevant part of the) back-trace is as follows:
#0 Python::PythonDeclarationCompletionItem::data(QModelIndex const&, int, KDevelop::CodeCompletionModel const*) const
(this=0x7ffed4ca3110, index=..., role=258, model=0x55555af291d0)
at kdev-python/codecompletion/items/declaration.cpp:92
#1 in KDevelop::CodeCompletionModel::data(QModelIndex const&, int) const (this=0x55555af291d0, index=..., role=258)
at kdevelop/kdevplatform/language/codecompletion/codecompletionmodel.cpp:378
#2 in KateCompletionModel::contextMatchQuality(QPair<KTextEditor::CodeCompletionModel*, QModelIndex> const&) const ()
at /usr/lib/x86_64-linux-gnu/libKF5TextEditor.so.5
The code crashes because `model->completionContext()->duContext()` is null at that point (although non-nullness was
checked previously on line 79 of kdev-python/codecompletion/items/declaration.cpp, per the fix by @Sven in f5353859631f12561)
Probably a DUChainReader lock around the switch statement would help?
|