Bug 202151

Summary: kdevelop crashes in KDevelop::FunctionTypeData::m_argumentsSize() when using autocomplete in CMake
Product: [Applications] kdevelop Reporter: Jonathan Thomas <echidnaman>
Component: Build tools: CMakeAssignee: kdevelop-bugs-null
Status: RESOLVED FIXED    
Severity: crash CC: devoutlytobewished
Priority: NOR    
Version: unspecified   
Target Milestone: ---   
Platform: Ubuntu   
OS: Linux   
Latest Commit: Version Fixed In:
Sentry Crash Report:

Description Jonathan Thomas 2009-08-01 00:52:55 UTC
Version:            (using KDE 4.2.98)
OS:                Linux
Installed from:    Ubuntu Packages

This was originally reported by a user at https://launchpad.net/bugs/407526
The setup is:
KDE 4.2.98
Qt 4.5.2
KDevelop 3.9.94

The original report was quite good so I'll let it speak for itself:
"When trying to use auto-complete in a CMake file kdevelop will crash if no code completion options are available.

Steps to reproduce.

1. Create a CMake based project.
2. While editing the CMake file try to use code completion making sure no matches will be found.
3. Hit the backspace button to delete what has been typed

When you get to the first character that was typed it will crash. This cannot be reproduced reliably when a code completion option is available."


The backtrace is as follows:
(gdb) continue                                                    
Continuing.                                                       
[New Thread 0xaedffb90 (LWP 17882)]                               
[New Thread 0xab310b90 (LWP 17883)]                               

Program received signal SIGSEGV, Segmentation fault.
0x04ea4b88 in KDevelop::FunctionTypeData::m_argumentsSize (this=0x0)
    at ../../language/duchain/types/typesystemdata.h:157            
157     ../../language/duchain/types/typesystemdata.h: No such file or directory.
        in ../../language/duchain/types/typesystemdata.h                         
Current language:  auto; currently c++                                           
(gdb) backtrace                                                                  
#0  0x04ea4b88 in KDevelop::FunctionTypeData::m_argumentsSize (this=0x0)         
    at ../../language/duchain/types/typesystemdata.h:157                         
#1  KDevelop::FunctionType::arguments (this=0x0) at ../../language/duchain/types/functiontype.cpp:120
#2  0x0307b9e4 in ?? () from /usr/lib/kde4/kdevcmakemanager.so                                       
#3  0x025d4755 in QModelIndex::data (this=0xa3aacc0, index=..., role=0)                              
    at /usr/include/qt4/QtCore/qabstractitemmodel.h:378                                              
#4  KateCompletionModel::data (this=0xa3aacc0, index=..., role=0)                                    
    at ../../kate/completion/katecompletionmodel.cpp:226                                             
#5  0x014840df in QModelIndex::data (this=0xa3b38f8, option=..., index=..., role=0)                  
    at ../../include/QtCore/../../src/corelib/kernel/qabstractitemmodel.h:378                        
#6  QItemDelegate::rect (this=0xa3b38f8, option=..., index=..., role=0) at itemviews/qitemdelegate.cpp:1075
#7  0x01484729 in QItemDelegate::sizeHint (this=0xa3b38f8, option=..., index=...)                          
    at itemviews/qitemdelegate.cpp:503                                                                     
#8  0x025f6a7a in ExpandingDelegate::sizeHint (this=0xa3b38f8, option=..., index=...)                      
    at ../../kate/completion/expandingtree/expandingdelegate.cpp:125                                       
#9  0x01439ad1 in QAbstractItemView::sizeHintForIndex (this=0xa316830, index=...)                          
    at itemviews/qabstractitemview.cpp:2700                                                                
#10 0x025e08eb in KateCompletionTree::resizeColumns (this=0xa316830, fromResizeEvent=false, firstShow=true, 
    forceResize=true) at ../../kate/completion/katecompletiontree.cpp:154                                   
#11 0x025cc22c in KateCompletionWidget::updateAndShow (this=0xa3a8890)                                      
    at ../../kate/completion/katecompletionwidget.cpp:413                                                   
#12 0x025ccd0f in KateCompletionWidget::modelContentChanged (this=0xa3a8890)                                
    at ../../kate/completion/katecompletionwidget.cpp:176                                                   
#13 0x025cf232 in KateCompletionWidget::qt_metacall (this=0xa3a8890, _c=QMetaObject::InvokeMetaMethod, _id=16, 
    _a=0xbfd6592c) at ./katecompletionwidget.moc:126                                                           
#14 0x00ce6383 in QMetaObject::activate (sender=0xa3aacc0, from_signal_index=23, to_signal_index=23, argv=0x0) 
    at kernel/qobject.cpp:3113                                                                                 
#15 0x00ce6fe2 in QMetaObject::activate (sender=0xa3aacc0, m=0x27a7348, local_signal_index=2, argv=0x0)        
    at kernel/qobject.cpp:3187                                                                                 
#16 0x025d10c7 in KateCompletionModel::contentGeometryChanged (this=0xa3aacc0) at ./katecompletionmodel.moc:121
#17 0x025dc90b in KateCompletionModel::setCurrentCompletion (this=0xa3aacc0, model=0x9cc37a8, completion=...)  
---Type <return> to continue, or q <return> to quit---                                                         
    at ../../kate/completion/katecompletionmodel.cpp:957                                                       
#18 0x025cbf7e in KateCompletionWidget::cursorPositionChanged (this=0xa3a8890)                                 
    at ../../kate/completion/katecompletionwidget.cpp:670                                                      
#19 0x025cf242 in KateCompletionWidget::qt_metacall (this=0xa3a8890, _c=QMetaObject::InvokeMetaMethod, _id=17, 
    _a=0x9b5a5c0) at ./katecompletionwidget.moc:127                                                            
#20 0x00cdf02b in QMetaCallEvent::placeMetaCall (this=0xa44c478, object=0xa3a8890) at kernel/qobject.cpp:477   
#21 0x00ce071e in QObject::event (this=0xa3a8890, e=0xa44c478) at kernel/qobject.cpp:1111                      
#22 0x00f395a6 in QWidget::event (this=0xa3a8890, event=0xa44c478) at kernel/qwidget.cpp:7946                  
#23 0x012e8e03 in QFrame::event (this=0xa3a8890, e=0xa44c478) at widgets/qframe.cpp:559                        
#24 0x00ee4c74 in QApplicationPrivate::notify_helper (this=0x925ee50, receiver=0xa3a8890, e=0xa44c478)         
    at kernel/qapplication.cpp:4056
#25 0x00eec2ea in QApplication::notify (this=0xbfd664e8, receiver=0xa3a8890, e=0xa44c478)
    at kernel/qapplication.cpp:4021
#26 0x0063bada in KApplication::notify (this=0xbfd664e8, receiver=0xa3a8890, event=0xa44c478)
    at ../../kdeui/kernel/kapplication.cpp:302
#27 0x00cd07eb in QCoreApplication::notifyInternal (this=0xbfd664e8, receiver=0xa3a8890, event=0xa44c478)
    at kernel/qcoreapplication.cpp:610
#28 0x00cd13d2 in QCoreApplication::sendEvent (receiver=0x0, event_type=0, data=0x91bf5b8)
    at ../../include/QtCore/../../src/corelib/kernel/qcoreapplication.h:213
#29 QCoreApplicationPrivate::sendPostedEvents (receiver=0x0, event_type=0, data=0x91bf5b8)
    at kernel/qcoreapplication.cpp:1247
#30 0x00cd159d in QCoreApplication::sendPostedEvents (receiver=0x0, event_type=0)
    at kernel/qcoreapplication.cpp:1140
#31 0x00cfb51f in QCoreApplication::sendPostedEvents (s=0x9261110)
    at ../../include/QtCore/../../src/corelib/kernel/qcoreapplication.h:218
#32 postEventSourceDispatch (s=0x9261110) at kernel/qeventdispatcher_glib.cpp:210
#33 0x0777cc48 in g_main_context_dispatch () from /usr/lib/libglib-2.0.so.0
#34 0x077804f0 in ?? () from /usr/lib/libglib-2.0.so.0
#35 0x07780623 in g_main_context_iteration () from /usr/lib/libglib-2.0.so.0
#36 0x00cfb14c in QEventDispatcherGlib::processEvents (this=0x91bf1a0, flags=...)
    at kernel/qeventdispatcher_glib.cpp:327
---Type <return> to continue, or q <return> to quit---
#37 0x00f857e5 in QGuiEventDispatcherGlib::processEvents (this=0x91bf1a0, flags=...)
    at kernel/qguieventdispatcher_glib.cpp:202
#38 0x00cced99 in QEventLoop::processEvents (this=0xbfd66404, flags=DWARF-2 expression error: DW_OP_reg operations must be used either alone or in conjuction with DW_OP_piece.
) at kernel/qeventloop.cpp:149
#39 0x00ccf1ea in QEventLoop::exec (this=0xbfd66404, flags=...) at kernel/qeventloop.cpp:201
#40 0x00cd165f in QCoreApplication::exec () at kernel/qcoreapplication.cpp:888
#41 0x00ee4af7 in QApplication::exec () at kernel/qapplication.cpp:3525
#42 0x0804f2f3 in _start ()
Comment 1 Andreas Pakulat 2009-08-01 02:33:49 UTC
Hmm, seems there's no debug package installed for kdevelop, that would be helpful. Apart from that, is this reproduceable after removing $HOME/.kdevduchain?
Comment 2 Jonathan Thomas 2009-08-01 15:27:48 UTC
Ok, the user reported that it still occurs with a fresh .kdevduchain.

He provided a new backtrace with debugging symbols:
(gdb) continue                                                                                                  
Continuing.                                                                                                     
                                                                                                                
Program received signal SIGSEGV, Segmentation fault.                                                            
0x03872b88 in KDevelop::FunctionTypeData::m_argumentsSize (this=0x0)                                            
    at ../../language/duchain/types/typesystemdata.h:157                                                        
157     ../../language/duchain/types/typesystemdata.h: No such file or directory.                               
        in ../../language/duchain/types/typesystemdata.h                                                        
(gdb) backtrace                                                                                                 
#0  0x03872b88 in KDevelop::FunctionTypeData::m_argumentsSize (this=0x0)                                        
    at ../../language/duchain/types/typesystemdata.h:157                                                        
#1  KDevelop::FunctionType::arguments (this=0x0) at ../../language/duchain/types/functiontype.cpp:120           
#2  0x01d0e9e4 in CMakeCodeCompletionModel::data (this=0x9d79190, index=..., role=0)                            
    at ../../../projectmanagers/cmake/cmakecodecompletionmodel.cpp:144                                          
#3  0x022ff755 in QModelIndex::data (this=0xa1354d8, index=..., role=0)                                         
    at /usr/include/qt4/QtCore/qabstractitemmodel.h:378                                                         
#4  KateCompletionModel::data (this=0xa1354d8, index=..., role=0)                                               
    at ../../kate/completion/katecompletionmodel.cpp:226                                                        
#5  0x0874c0df in QModelIndex::data (this=0xa13c2e0, option=..., index=..., role=0)                             
    at ../../include/QtCore/../../src/corelib/kernel/qabstractitemmodel.h:378                                   
#6  QItemDelegate::rect (this=0xa13c2e0, option=..., index=..., role=0) at itemviews/qitemdelegate.cpp:1075     
#7  0x0874c729 in QItemDelegate::sizeHint (this=0xa13c2e0, option=..., index=...)                               
    at itemviews/qitemdelegate.cpp:503                                                                          
#8  0x02321a7a in ExpandingDelegate::sizeHint (this=0xa13c2e0, option=..., index=...)                           
    at ../../kate/completion/expandingtree/expandingdelegate.cpp:125                                            
#9  0x08701ad1 in QAbstractItemView::sizeHintForIndex (this=0xa135850, index=...)                               
    at itemviews/qabstractitemview.cpp:2700                                                                     
#10 0x0230b8eb in KateCompletionTree::resizeColumns (this=0xa135850, fromResizeEvent=false, firstShow=true,     
    forceResize=true) at ../../kate/completion/katecompletiontree.cpp:154                                       
#11 0x022f722c in KateCompletionWidget::updateAndShow (this=0xa135250)                                          
    at ../../kate/completion/katecompletionwidget.cpp:413                                                       
#12 0x022f7d0f in KateCompletionWidget::modelContentChanged (this=0xa135250)
    at ../../kate/completion/katecompletionwidget.cpp:176
#13 0x022fa232 in KateCompletionWidget::qt_metacall (this=0xa135250, _c=QMetaObject::InvokeMetaMethod, _id=16,
    _a=0xbfd3f80c) at ./katecompletionwidget.moc:126
#14 0x00a04383 in QMetaObject::activate (sender=0xa1354d8, from_signal_index=23, to_signal_index=23, argv=0x0)
    at kernel/qobject.cpp:3113
#15 0x00a04fe2 in QMetaObject::activate (sender=0xa1354d8, m=0x24d2348, local_signal_index=2, argv=0x0)
    at kernel/qobject.cpp:3187
#16 0x022fc0c7 in KateCompletionModel::contentGeometryChanged (this=0xa1354d8) at ./katecompletionmodel.moc:121
---Type <return> to continue, or q <return> to quit---
#17 0x0230790b in KateCompletionModel::setCurrentCompletion (this=0xa1354d8, model=0x9d79190, completion=...)
    at ../../kate/completion/katecompletionmodel.cpp:957
#18 0x022f6f7e in KateCompletionWidget::cursorPositionChanged (this=0xa135250)
    at ../../kate/completion/katecompletionwidget.cpp:670
#19 0x022fa242 in KateCompletionWidget::qt_metacall (this=0xa135250, _c=QMetaObject::InvokeMetaMethod, _id=17,
    _a=0xad0c2e0) at ./katecompletionwidget.moc:127
#20 0x009fd02b in QMetaCallEvent::placeMetaCall (this=0xa93d9d0, object=0xa135250) at kernel/qobject.cpp:477
#21 0x009fe71e in QObject::event (this=0xa135250, e=0xa93d9d0) at kernel/qobject.cpp:1111
#22 0x082015a6 in QWidget::event (this=0xa135250, event=0xa93d9d0) at kernel/qwidget.cpp:7946
#23 0x085b0e03 in QFrame::event (this=0xa135250, e=0xa93d9d0) at widgets/qframe.cpp:559
#24 0x081acc74 in QApplicationPrivate::notify_helper (this=0x9729d68, receiver=0xa135250, e=0xa93d9d0)
    at kernel/qapplication.cpp:4056
#25 0x081b42ea in QApplication::notify (this=0xbfd403c8, receiver=0xa135250, e=0xa93d9d0)
    at kernel/qapplication.cpp:4021
#26 0x00e65ada in KApplication::notify (this=0xbfd403c8, receiver=0xa135250, event=0xa93d9d0)
    at ../../kdeui/kernel/kapplication.cpp:302
#27 0x009ee7eb in QCoreApplication::notifyInternal (this=0xbfd403c8, receiver=0xa135250, event=0xa93d9d0)
    at kernel/qcoreapplication.cpp:610
#28 0x009ef3d2 in QCoreApplication::sendEvent (receiver=0x0, event_type=0, data=0x968a5b8)
    at ../../include/QtCore/../../src/corelib/kernel/qcoreapplication.h:213
#29 QCoreApplicationPrivate::sendPostedEvents (receiver=0x0, event_type=0, data=0x968a5b8)
    at kernel/qcoreapplication.cpp:1247
#30 0x009ef59d in QCoreApplication::sendPostedEvents (receiver=0x0, event_type=0)
    at kernel/qcoreapplication.cpp:1140
#31 0x00a1951f in QCoreApplication::sendPostedEvents (s=0x972c110)
    at ../../include/QtCore/../../src/corelib/kernel/qcoreapplication.h:218
#32 postEventSourceDispatch (s=0x972c110) at kernel/qeventdispatcher_glib.cpp:210
#33 0x073eec48 in g_main_context_dispatch () from /usr/lib/libglib-2.0.so.0
#34 0x073f24f0 in ?? () from /usr/lib/libglib-2.0.so.0
#35 0x073f2623 in g_main_context_iteration () from /usr/lib/libglib-2.0.so.0
#36 0x00a1914c in QEventDispatcherGlib::processEvents (this=0x968a1a0, flags=...)
---Type <return> to continue, or q <return> to quit---
    at kernel/qeventdispatcher_glib.cpp:327
#37 0x0824d7e5 in QGuiEventDispatcherGlib::processEvents (this=0x968a1a0, flags=...)
    at kernel/qguieventdispatcher_glib.cpp:202
#38 0x009ecd99 in QEventLoop::processEvents (this=0xbfd402e4, flags=DWARF-2 expression error: DW_OP_reg operations must be used either alone or in conjuction with DW_OP_piece.
) at kernel/qeventloop.cpp:149
#39 0x009ed1ea in QEventLoop::exec (this=0xbfd402e4, flags=...) at kernel/qeventloop.cpp:201
#40 0x009ef65f in QCoreApplication::exec () at kernel/qcoreapplication.cpp:888
#41 0x081acaf7 in QApplication::exec () at kernel/qapplication.cpp:3525
#42 0x0804f2f3 in main (argc=1, argv=0xbfd408b4) at ../../app/main.cpp:172


He also provided a full stacktrace:http://launchpadlibrarian.net/29773276/stacktrace_full.txt
Comment 3 Andreas Pakulat 2009-08-01 17:47:02 UTC
SVN commit 1005639 by apaku:

Never put assignments into a Q_ASSERT - or any other code that has
side-effects that following code relies on. release builds _never_
execute whatever is put into the Q_ASSERT macro.
BUG:202151
CCMAIL:aleixpol@gmail.com

 M  +6 -2      cmakecodecompletionmodel.cpp  


WebSVN link: http://websvn.kde.org/?view=rev&revision=1005639
Comment 4 Milian Wolff 2011-03-02 20:53:45 UTC
*** Bug 267474 has been marked as a duplicate of this bug. ***
Comment 5 Milian Wolff 2011-03-02 20:54:04 UTC
still crashing
Comment 6 Milian Wolff 2011-03-02 20:57:05 UTC
Git commit c87d9a6a0c348bffaab26392f39fe0042dfd7796 by Milian Wolff.
Committed on 02/03/2011 at 20:54.
Pushed by mwolff into branch '4.2'.

prevent crash in cmake code completion

BUG: 202151

M  +6    -6    projectmanagers/cmake/cmakecodecompletionmodel.cpp     

http://commits.kde.org/kdevelop/c87d9a6a0c348bffaab26392f39fe0042dfd7796