[QScintilla] Fix ASSERT on insert '(' after api_entry without parenthis

Dmitriy Valento decobramegra at gmail.com
Thu Oct 15 14:16:35 BST 2009


On trying insert '(' after api_entry (for example types.TypeType) 
without parenthis, whose selected from autoCompletition lis, i got ASSERT:
> ASSERT: "i >= 0 && i < size()" in file 
> /opt/qtsdk-2009.04/qt/include/QtCore/qstring.h, line 
> 685                                               
>
> Program received signal SIGABRT, Aborted.
> [Switching to Thread 0xb6afa6c0 (LWP 25156)]
> 0xb7f89430 in __kernel_vsyscall ()          
> (gdb) bt                                    
> #0  0xb7f89430 in __kernel_vsyscall ()      
> #1  0xb6bbc8a0 in raise () from /lib/tls/i686/cmov/libc.so.6
> #2  0xb6bbe268 in abort () from /lib/tls/i686/cmov/libc.so.6
> #3  0xb6f45965 in qt_message_output (msgType=QtFatalMsg,    
>     buf=0xb379cd0 "ASSERT: \"i >= 0 && i < size()\" in file 
> /opt/qtsdk-2009.04/qt/include/QtCore/qstring.h, line 685")
>     at 
> /var/tmp/qt-x11-src-4.5.3/src/corelib/global/qglobal.cpp:2042                                                 
>  
> #4  0xb6f45a41 in qFatal (msg=0xb70a6508 "ASSERT: \"%s\" in file %s, 
> line %d")                                        
>     at 
> /var/tmp/qt-x11-src-4.5.3/src/corelib/global/qglobal.cpp:2241                                                 
>  
> #5  0xb6f45b45 in qt_assert (assertion=0x835422d "i >= 0 && i < 
> size()", file=0x83541e8 "/opt/qtsdk-2009.04/qt/include/QtCore/qstring.h",
>     line=685) at 
> /var/tmp/qt-x11-src-4.5.3/src/corelib/global/qglobal.cpp:1811                                                           
>  
> warning: (Internal error: pc 0x8269451 in read in psymtab, but not in 
> symtab.)                                                            
>
> #6  0x08269452 in QString::at (this=warning: (Internal error: pc 
> 0x8269451 in read in psymtab, but not in symtab.)
>
> warning: (Internal error: pc 0x826940a in read in psymtab, but not in 
> symtab.)
>
> warning: (Internal error: pc 0x8269451 in read in psymtab, but not in 
> symtab.)
>
> 0xbfd88300, i=warning: (Internal error: pc 0x8269451 in read in 
> psymtab, but not in symtab.)
>
> 0) at /opt/qtsdk-2009.04/qt/include/QtCore/qstring.h:685
> #7  0xb7e4296c in QsciAPIs::originStartsWith (this=0xa866540, 
> path=@0xbfd88444, wsep=@0xbfd88388) at qsciapis.cpp:417
> #8  0xb7e42d67 in QsciAPIs::positionOrigin (this=0xa866540, 
> context=@0xbfd884f0, path=@0xbfd88444) at qsciapis.cpp:377
> #9  0xb7e4316e in QsciAPIs::callTips (this=0xa866540, 
> context=@0xbfd884f0, commas=0, style=QsciScintilla::CallTipsContext, 
> shifts=@0xb2f2d8e4)
>     at qsciapis.cpp:657
> #10 0xb7e3acdd in QsciScintilla::callTip (this=0xb2f2d850) at 
> qsciscintilla.cpp:326
> #11 0xb7e3a5ff in QsciScintilla::handleCharAdded (this=0xb2f2d850, 
> ch=40) at qsciscintilla.cpp:243
> #12 0xb7f20b5a in QsciScintilla::qt_metacall (this=0xb2f2d850, 
> _c=QMetaObject::InvokeMetaMethod, _id=88, _a=0xbfd886bc)
>     at moc_qsciscintilla.cpp:339
> #13 0x08238524 in pEditor::qt_metacall (this=0xb2f2d850, 
> _c=QMetaObject::InvokeMetaMethod, _id=149, _a=0xbfd886bc)
>     at ../build/debug/.moc/moc_pEditor.cpp:100
> #14 0xb70649db in QMetaObject::activate (sender=0xb2f2d850, 
> from_signal_index=<value optimized out>, to_signal_index=37, 
> argv=0xbfd886bc)
>     at /var/tmp/qt-x11-src-4.5.3/src/corelib/kernel/qobject.cpp:3104
> #15 0xb70650b2 in QMetaObject::activate (sender=0xb2f2d850, 
> m=0xb7f6656c, local_signal_index=6, argv=0xbfd886bc)
>     at /var/tmp/qt-x11-src-4.5.3/src/corelib/kernel/qobject.cpp:3178
> #16 0xb7f21532 in QsciScintillaBase::SCN_CHARADDED (this=0xb2f2d850, 
> _t1=40) at moc_qsciscintillabase.cpp:202
> #17 0xb7e77225 in ScintillaQt::NotifyParent (this=0xb1b60b48, scn=
>       {nmhdr = {hwndFrom = 0x0, idFrom = 0, code = 2001}, position = 
> 0, ch = 40, modifiers = 0, modificationType = 0, text = 0x0, length = 
> 0, linesAdded = 0, message = 0, wParam = 0, lParam = 0, line = 0, 
> foldLevelNow = 0, foldLevelPrev = 0, margin = 0, listType = 0, x = 0, 
> y = 0, token = 0, annotationLinesAdded = 0}) at ScintillaQt.cpp:301
> #18 0xb7e89d32 in Editor::NotifyChar (this=0xb1b60b48, ch=40) at 
> ../src/Editor.cpp:3821
> #19 0xb7e9a317 in Editor::AddCharUTF (this=0xb1b60b48, s=0x9ee0220 
> "(", len=1, treatAsDBCS=false) at ../src/Editor.cpp:3609
> #20 0xb7f1a672 in ScintillaBase::AddCharUTF (this=0xb1b60b48, 
> s=0x9ee0220 "(", len=1, treatAsDBCS=false) at ../src/ScintillaBase.cpp:81
> #21 0xb7e3fb56 in QsciScintillaBase::keyPressEvent (this=0xb2f2d850, 
> e=0xbfd88e44) at qsciscintillabase.cpp:446
> #22 0x0812c6cc in pEditor::keyPressEvent (this=0xb2f2d850, 
> e=0xbfd88e44) at src/qscintillamanager/pEditor.cpp:140
I suggest add check on empty QString tail like that:

bool QsciAPIs::originStartsWith(const QString &path, const QString &wsep)
{
.....
    QString tail = orig.mid(path.length());

+    if tail.isEmpty()
+        return false;

    return (tail.startsWith(wsep) || tail.at(0) == '(');
}



More information about the QScintilla mailing list