Bug 180743

Summary: Crash: Assert failed in KateSmartManager::groupForLine
Product: [Applications] kate Reporter: Will Angenent <will.angenent>
Component: generalAssignee: KWrite Developers <kwrite-bugs-null>
Status: RESOLVED NOT A BUG    
Severity: crash CC: andresbajotierra, bartoschek, niko.sams
Priority: NOR    
Version: unspecified   
Target Milestone: ---   
Platform: Compiled Sources   
OS: Linux   
Latest Commit: Version Fixed In:
Sentry Crash Report:
Attachments: full backtrace

Description Will Angenent 2009-01-14 23:37:49 UTC
Version:           v3.2.60 svn r910563 (using Devel)
Compiler:          gcc version 4.3.2 (Ubuntu 4.3.2-1ubuntu11) using kubuntu 8.10
OS:                Linux
Installed from:    Compiled sources

Sorry to say I hit an assertion failed:
  // If you hit this assert, it is a fundamental bug in katepart.  A cursor's
  // position is being set beyond the end of the document, or (perhaps less
  // likely), in this class itself.
  //
  // Please figure out how to reproduce, and report to rodda@kde.org.
  Q_ASSERT(smartGroup);

I was editing a cpp file with static wordwrap turned on and repeatedly copy pasting a block which was being wrapped automatically. I was being silly and hadn't realized static wordwrap was on. Something strange was happening, because I was pressing delete at the start of a second wordwrapped line, which should have deleted the previous character, but nothing was happening. After a couple of minutes of banging my head against the wall, and lots of copying pasting of the same piece of text, I used the arrow key down to go to the end of the document, and that's when kate crashed.

I tried to reproduce, but haven't been able to. I'll keep trying...

Will

Thread 1 (Thread 0x7f93c378f6f0 (LWP 15953)):
[KCrash Handler]
#5  0x00007f93bf89efd5 in raise () from /lib/libc.so.6
#6  0x00007f93bf8a0b43 in abort () from /lib/libc.so.6
#7  0x00007f93c06086b5 in qt_message_output () from /usr/lib/libQtCore.so.4
#8  0x00007f93c06087fd in qFatal () from /usr/lib/libQtCore.so.4
#9  0x00007f93b6e45b82 in KateSmartManager::groupForLine (this=<value optimized out>, line=<value optimized out>) at /home/kde-devel/kde/src/KDE/kdelibs-git/kate/smart/katesmartmanager.cpp:303
#10 0x00007f93b6e406eb in KateSmartCursor::setPositionInternal (this=0x10c4998, pos=@0x7fffcb7cd8f0, internal=false) at /home/kde-devel/kde/src/KDE/kdelibs-git/kate/smart/katesmartcursor.cpp:181
#11 0x00007f93b6e413f7 in KateSmartCursor::setPosition (this=0x10c4998, pos=@0x7fffcb7cd8f0) at /home/kde-devel/kde/src/KDE/kdelibs-git/kate/smart/katesmartcursor.cpp:414
#12 0x00007f93b6e9477e in KateViewInternal::updateCursor (this=0x10c4910, newCursor=@0x7fffcb7cd8f0, force=<value optimized out>, center=false, calledExternally=false)
    at /home/kde-devel/kde/src/KDE/kdelibs-git/kate/smart/katesmartcursor.h:69
#13 0x00007f93b6e96b2a in KateViewInternal::cursorDown (this=0x10c4910, sel=<value optimized out>) at /home/kde-devel/kde/src/KDE/kdelibs-git/kate/view/kateviewinternal.cpp:1483
#14 0x00007f93b6e810f5 in KateView::qt_metacall (this=0x10a27e0, _c=QMetaObject::InvokeMetaMethod, _id=<value optimized out>, _a=0x7fffcb7cda70)
    at /home/kde-devel/kde/build/KDE/kdelibs-git/kate/kateview.moc:380
Comment 1 Will Angenent 2009-01-14 23:39:31 UTC
Created attachment 30247 [details]
full backtrace
Comment 2 Dario Andres 2009-02-15 23:40:26 UTC
Probably related/duplicate of bug 175494
Comment 3 Christoph Cullmann 2009-07-08 12:50:53 UTC
Thanks for the report, but without way to reproduce it, no chance to fix :(
Comment 4 Andreas Pakulat 2009-07-26 00:46:02 UTC
*** Bug 195349 has been marked as a duplicate of this bug. ***
Comment 5 Niko Sams 2010-01-12 22:12:00 UTC
I just hit that assertion twice.

A file got changed outside of kdevelop, I switched to that tab, kdevelop asked if I want to reload and then got the crash. The file didn't change a lot (as in a few of 2500)

KDE 4.3.82 (KDE 4.4 >= 20091211)

#4  0x00007f583c47b205 in raise () from /lib/libc.so.6
#5  0x00007f583c47c723 in abort () from /lib/libc.so.6
#6  0x00007f583e0349dd in qt_message_output(QtMsgType, char const*) () from /usr/lib64/qt4/libQtCore.so.4
#7  0x00007f583e034b7d in ?? () from /usr/lib64/qt4/libQtCore.so.4
#8  0x00007f583e034d35 in qFatal(char const*, ...) () from /usr/lib64/qt4/libQtCore.so.4
#9  0x00007f5818fbc810 in KateSmartManager::groupForLine (this=0x7f5814309810, line=249) at /home/niko/kdesvn/kde-git/kdelibs/kate/smart/katesmartmanager.cpp:307
#10 0x00007f5818fb8baf in KateSmartCursor (this=0x44879a0, position=..., doc=0x5f6dda0, insertBehavior=KTextEditor::SmartCursor::MoveOnInsert)
    at /home/niko/kdesvn/kde-git/kdelibs/kate/smart/katesmartcursor.cpp:49
#11 0x00007f5818fbb439 in KateSmartRange (this=0x5556d10, range=..., doc=0x5f6dda0, parent=0x0, insertBehavior=...) at /home/niko/kdesvn/kde-git/kdelibs/kate/smart/katesmartrange.cpp:36
#12 0x00007f5818fbf28a in KateSmartManager::newSmartRange (this=0x7f5814309810, range=..., parent=0x0, insertBehavior=..., internal=false)
    at /home/niko/kdesvn/kde-git/kdelibs/kate/smart/katesmartmanager.cpp:211
#13 0x00007f5818f4d0a7 in KateDocument::newSmartRange (this=0x5f6dda0, range=..., parent=0x0, insertBehavior=...) at /home/niko/kdesvn/kde-git/kdelibs/kate/document/katedocument.cpp:4766
#14 0x00007f583a71f771 in KDevelop::EditorIntegratorPrivate::createRange<KTextEditor::SmartRange> (this=0x72f0a70, iface=..., range=..., insertBehavior=...)
    at /home/niko/kdesvn/sdk-git/kdevplatform/language/editor/editorintegrator.cpp:170
#15 0x00007f583a71f936 in KDevelop::EditorIntegrator::createRange (this=0x7f581fffe420, iface=..., range=..., insertBehavior=...)
    at /home/niko/kdesvn/sdk-git/kdevplatform/language/editor/editorintegrator.cpp:293
#16 0x00007f5826836e71 in KDevelop::AbstractUseBuilder<AST, NameAST, ContextBuilder>::newUse (this=0x7f581fffdde0, node=0x596a2a0, newRange=..., declaration=0x5ca17c0)
    at /home/niko/kde/include/kdevplatform/language/duchain/builders/abstractusebuilder.h:187
#17 0x00007f582683710a in UseExpressionVisitor::usingDeclaration (this=0x7f581fffcae0, node=0x596a2a0, start_token=1197, end_token=1198, decl=...)
    at /home/niko/kdesvn/sdk-git/kdevelop/languages/cpp/cppduchain/usebuilder.cpp:140
#18 0x00007f582687dce2 in Cpp::ExpressionVisitor::flushUse (this=0x7f581fffcae0) at /home/niko/kdesvn/sdk-git/kdevelop/languages/cpp/cppduchain/expressionvisitor.h:189
#19 0x00007f582687eedf in Cpp::ExpressionVisitor::newUse (this=0x7f581fffcae0, node=0x5969fc0, start_token=1193, end_token=1194, decl=...)
    at /home/niko/kdesvn/sdk-git/kdevelop/languages/cpp/cppduchain/expressionvisitor.h:165
#20 0x00007f582687aafa in Cpp::ExpressionVisitor::visitFunctionCall (this=0x7f581fffcae0, node=0x596a498) at /home/niko/kdesvn/sdk-git/kdevelop/languages/cpp/cppduchain/expressionvisitor.cpp:1900
#21 0x00007f582653e689 in Visitor::visit (this=0x7f581fffcae0, node=0x596a498) at /home/niko/kdesvn/sdk-git/kdevelop/languages/cpp/parser/visitor.cpp:113
#22 0x00007f5826873f47 in Cpp::ExpressionVisitor::visitSubExpressions (this=0x7f581fffcae0, node=0x596a4e0, nodes=0x596a4c8)
    at /home/niko/kdesvn/sdk-git/kdevelop/languages/cpp/cppduchain/expressionvisitor.cpp:745
#23 0x00007f5826874347 in Cpp::ExpressionVisitor::visitPostfixExpression (this=0x7f581fffcae0, node=0x596a4e0) at /home/niko/kdesvn/sdk-git/kdevelop/languages/cpp/cppduchain/expressionvisitor.cpp:783
#24 0x00007f582653e689 in Visitor::visit (this=0x7f581fffcae0, node=0x596a4e0) at /home/niko/kdesvn/sdk-git/kdevelop/languages/cpp/parser/visitor.cpp:113
#25 0x00007f582687222b in Cpp::ExpressionVisitor::visitExpressionStatement (this=0x7f581fffcae0, node=0x596a520)
    at /home/niko/kdesvn/sdk-git/kdevelop/languages/cpp/cppduchain/expressionvisitor.cpp:1456
#26 0x00007f582653e689 in Visitor::visit (this=0x7f581fffcae0, node=0x596a520) at /home/niko/kdesvn/sdk-git/kdevelop/languages/cpp/parser/visitor.cpp:113
#27 0x00007f5826872389 in Cpp::ExpressionVisitor::parse (this=0x7f581fffcae0, ast=0x596a520) at /home/niko/kdesvn/sdk-git/kdevelop/languages/cpp/cppduchain/expressionvisitor.cpp:232
#28 0x00007f5826832ca3 in UseBuilder::visitExpression (this=0x7f581fffdde0, node=0x596a520) at /home/niko/kdesvn/sdk-git/kdevelop/languages/cpp/cppduchain/usebuilder.cpp:161
#29 0x00007f5826832e51 in UseBuilder::visitExpressionStatement (this=0x7f581fffdde0, exp=0x596a520) at /home/niko/kdesvn/sdk-git/kdevelop/languages/cpp/cppduchain/usebuilder.cpp:84
#30 0x00007f582653e689 in Visitor::visit (this=0x7f581fffde40, node=0x596a520) at /home/niko/kdesvn/sdk-git/kdevelop/languages/cpp/parser/visitor.cpp:113
#31 0x00007f582653c4e5 in visitNodes<StatementAST*> (v=0x7f581fffde40, nodes=0x596a5e8) at /home/niko/kdesvn/sdk-git/kdevelop/languages/cpp/parser/visitor.h:128
#32 0x00007f582653bcb7 in DefaultVisitor::visitCompoundStatement (this=0x7f581fffde40, node=0x5969c18) at /home/niko/kdesvn/sdk-git/kdevelop/languages/cpp/parser/default_visitor.cpp:68
#33 0x00007f58267e74cf in ContextBuilder::visitCompoundStatement (this=0x7f581fffdde0, node=0x5969c18) at /home/niko/kdesvn/sdk-git/kdevelop/languages/cpp/cppduchain/contextbuilder.cpp:790
#34 0x00007f582653e689 in Visitor::visit (this=0x7f581fffde40, node=0x5969c18) at /home/niko/kdesvn/sdk-git/kdevelop/languages/cpp/parser/visitor.cpp:113
#35 0x00007f58267e6ce2 in ContextBuilder::visitIfStatement (this=0x7f581fffdde0, node=0x5969720) at /home/niko/kdesvn/sdk-git/kdevelop/languages/cpp/cppduchain/contextbuilder.cpp:1102
#36 0x00007f582653e689 in Visitor::visit (this=0x7f581fffde40, node=0x5969720) at /home/niko/kdesvn/sdk-git/kdevelop/languages/cpp/parser/visitor.cpp:113
#37 0x00007f582653c4e5 in visitNodes<StatementAST*> (v=0x7f581fffde40, nodes=0x596eaa8) at /home/niko/kdesvn/sdk-git/kdevelop/languages/cpp/parser/visitor.h:128
#38 0x00007f582653bcb7 in DefaultVisitor::visitCompoundStatement (this=0x7f581fffde40, node=0x5966d20) at /home/niko/kdesvn/sdk-git/kdevelop/languages/cpp/parser/default_visitor.cpp:68
#39 0x00007f58267e74cf in ContextBuilder::visitCompoundStatement (this=0x7f581fffdde0, node=0x5966d20) at /home/niko/kdesvn/sdk-git/kdevelop/languages/cpp/cppduchain/contextbuilder.cpp:790
#40 0x00007f582653e689 in Visitor::visit (this=0x7f581fffde40, node=0x5966d20) at /home/niko/kdesvn/sdk-git/kdevelop/languages/cpp/parser/visitor.cpp:113
#41 0x00007f58267e6ce2 in ContextBuilder::visitIfStatement (this=0x7f581fffdde0, node=0x5966828) at /home/niko/kdesvn/sdk-git/kdevelop/languages/cpp/cppduchain/contextbuilder.cpp:1102
#42 0x00007f582653e689 in Visitor::visit (this=0x7f581fffde40, node=0x5966828) at /home/niko/kdesvn/sdk-git/kdevelop/languages/cpp/parser/visitor.cpp:113
#43 0x00007f582653c4e5 in visitNodes<StatementAST*> (v=0x7f581fffde40, nodes=0x596f360) at /home/niko/kdesvn/sdk-git/kdevelop/languages/cpp/parser/visitor.h:128
#44 0x00007f582653bcb7 in DefaultVisitor::visitCompoundStatement (this=0x7f581fffde40, node=0x5965898) at /home/niko/kdesvn/sdk-git/kdevelop/languages/cpp/parser/default_visitor.cpp:68
#45 0x00007f58267e74cf in ContextBuilder::visitCompoundStatement (this=0x7f581fffdde0, node=0x5965898) at /home/niko/kdesvn/sdk-git/kdevelop/languages/cpp/cppduchain/contextbuilder.cpp:790
#46 0x00007f582653e689 in Visitor::visit (this=0x7f581fffde40, node=0x5965898) at /home/niko/kdesvn/sdk-git/kdevelop/languages/cpp/parser/visitor.cpp:113
#47 0x00007f58267e8383 in ContextBuilder::visitFunctionDefinition (this=0x7f581fffdde0, node=0x596f378) at /home/niko/kdesvn/sdk-git/kdevelop/languages/cpp/cppduchain/contextbuilder.cpp:704
#48 0x00007f582653e689 in Visitor::visit (this=0x7f581fffde40, node=0x596f378) at /home/niko/kdesvn/sdk-git/kdevelop/languages/cpp/parser/visitor.cpp:113
#49 0x00007f582653c3f5 in visitNodes<DeclarationAST*> (v=0x7f581fffde40, nodes=0x6da06f0) at /home/niko/kdesvn/sdk-git/kdevelop/languages/cpp/parser/visitor.h:128
#50 0x00007f582653bc13 in DefaultVisitor::visitLinkageBody (this=0x7f581fffde40, node=0x2c75b00) at /home/niko/kdesvn/sdk-git/kdevelop/languages/cpp/parser/default_visitor.cpp:221
#51 0x00007f582653e689 in Visitor::visit (this=0x7f581fffde40, node=0x2c75b00) at /home/niko/kdesvn/sdk-git/kdevelop/languages/cpp/parser/visitor.cpp:113
#52 0x00007f582653b48f in DefaultVisitor::visitNamespace (this=0x7f581fffde40, node=0x2c75ac0) at /home/niko/kdesvn/sdk-git/kdevelop/languages/cpp/parser/default_visitor.cpp:244
#53 0x00007f58267e8b6c in ContextBuilder::visitNamespace (this=0x7f581fffdde0, node=0x2c75ac0) at /home/niko/kdesvn/sdk-git/kdevelop/languages/cpp/cppduchain/contextbuilder.cpp:586
#54 0x00007f582653e689 in Visitor::visit (this=0x7f581fffde40, node=0x2c75ac0) at /home/niko/kdesvn/sdk-git/kdevelop/languages/cpp/parser/visitor.cpp:113
#55 0x00007f582653c3f5 in visitNodes<DeclarationAST*> (v=0x7f581fffde40, nodes=0x6da0708) at /home/niko/kdesvn/sdk-git/kdevelop/languages/cpp/parser/visitor.h:128
#56 0x00007f582653bbef in DefaultVisitor::visitTranslationUnit (this=0x7f581fffde40, node=0x8273c90) at /home/niko/kdesvn/sdk-git/kdevelop/languages/cpp/parser/default_visitor.cpp:394
#57 0x00007f582653e689 in Visitor::visit (this=0x7f581fffde40, node=0x8273c90) at /home/niko/kdesvn/sdk-git/kdevelop/languages/cpp/parser/visitor.cpp:113
#58 0x00007f58267e6255 in ContextBuilder::startVisiting (this=0x7f581fffdde0, node=0x8273c90) at /home/niko/kdesvn/sdk-git/kdevelop/languages/cpp/cppduchain/contextbuilder.cpp:226
#59 0x00007f58267ef714 in KDevelop::AbstractContextBuilder<AST, NameAST>::supportBuild (this=0x7f581fffdde0, node=0x8273c90, context=0x67c9f20)
    at /home/niko/kde/include/kdevplatform/language/duchain/builders/abstractcontextbuilder.h:201
#60 0x00007f582683742d in KDevelop::AbstractUseBuilder<AST, NameAST, ContextBuilder>::buildUses (this=0x7f581fffdde0, node=0x8273c90)
    at /home/niko/kde/include/kdevplatform/language/duchain/builders/abstractusebuilder.h:70
#61 0x00007f5826833629 in UseBuilder::buildUses (this=0x7f581fffdde0, node=0x8273c90) at /home/niko/kdesvn/sdk-git/kdevelop/languages/cpp/cppduchain/usebuilder.cpp:66
#62 0x00007f5826d4a496 in CPPInternalParseJob::run (this=0x7f58147ab860) at /home/niko/kdesvn/sdk-git/kdevelop/languages/cpp/cppparsejob.cpp:726
#63 0x00007f583fc1069f in ThreadWeaver::JobRunHelper::runTheJob (this=0x7f581fffefb0, th=0x396e450, job=0x7f58147ab860) at /home/niko/kdesvn/kde-git/kdelibs/threadweaver/Weaver/Job.cpp:106
#64 0x00007f583fc108d9 in ThreadWeaver::Job::execute (this=0x7f58147ab860, th=0x396e450) at /home/niko/kdesvn/kde-git/kdelibs/threadweaver/Weaver/Job.cpp:135
#65 0x00007f583fc12f26 in ThreadWeaver::JobCollectionJobRunner::execute (this=0x7f581450ed10, t=0x396e450) at /home/niko/kdesvn/kde-git/kdelibs/threadweaver/Weaver/JobCollection.cpp:82
#66 0x00007f583fc0fb58 in ThreadWeaver::ThreadRunHelper::run (this=0x7f581ffff090, parent=0x1059470, th=0x396e450) at /home/niko/kdesvn/kde-git/kdelibs/threadweaver/Weaver/Thread.cpp:95
#67 0x00007f583fc0fca1 in ThreadWeaver::Thread::run (this=0x396e450) at /home/niko/kdesvn/kde-git/kdelibs/threadweaver/Weaver/Thread.cpp:142
#68 0x00007f583e03df7a in ?? () from /usr/lib64/qt4/libQtCore.so.4
#69 0x00007f583ddad007 in start_thread () from /lib/libpthread.so.0
#70 0x00007f583c51948d in clone () from /lib/libc.so.6
#71 0x0000000000000000 in ?? ()

Thread 3 (Thread 0x7f581f7fe950 (LWP 29632)):
#0  0x00007f583ddb0db9 in pthread_cond_wait@@GLIBC_2.3.2 () from /lib/libpthread.so.0
#1  0x00007f583e03efd5 in QWaitCondition::wait(QMutex*, unsigned long) () from /usr/lib64/qt4/libQtCore.so.4
#2  0x00007f583fc0cf11 in ThreadWeaver::WeaverImpl::blockThreadUntilJobsAreBeingAssigned (this=0x1c33f90, th=0x45a1bf0) at /home/niko/kdesvn/kde-git/kdelibs/threadweaver/Weaver/WeaverImpl.cpp:365
#3  0x00007f583fc1183f in ThreadWeaver::WorkingHardState::waitForAvailableJob (this=0x45adc70, th=0x45a1bf0) at /home/niko/kdesvn/kde-git/kdelibs/threadweaver/Weaver/WorkingHardState.cpp:80
#4  0x00007f583fc0c64e in ThreadWeaver::WeaverImpl::waitForAvailableJob (this=0x1c33f90, th=0x45a1bf0) at /home/niko/kdesvn/kde-git/kdelibs/threadweaver/Weaver/WeaverImpl.cpp:356
#5  0x00007f583fc11937 in ThreadWeaver::WorkingHardState::applyForWork (this=0x45adc70, th=0x45a1bf0) at /home/niko/kdesvn/kde-git/kdelibs/threadweaver/Weaver/WorkingHardState.cpp:71
#6  0x00007f583fc0d14d in ThreadWeaver::WeaverImpl::applyForWork (this=0x1c33f90, th=0x45a1bf0, previous=0x1d911b0) at /home/niko/kdesvn/kde-git/kdelibs/threadweaver/Weaver/WeaverImpl.cpp:351
#7  0x00007f583fc0fb0c in ThreadWeaver::ThreadRunHelper::run (this=0x7f581f7fe090, parent=0x1c33f90, th=0x45a1bf0) at /home/niko/kdesvn/kde-git/kdelibs/threadweaver/Weaver/Thread.cpp:87
#8  0x00007f583fc0fca1 in ThreadWeaver::Thread::run (this=0x45a1bf0) at /home/niko/kdesvn/kde-git/kdelibs/threadweaver/Weaver/Thread.cpp:142
#9  0x00007f583e03df7a in ?? () from /usr/lib64/qt4/libQtCore.so.4
#10 0x00007f583ddad007 in start_thread () from /lib/libpthread.so.0
#11 0x00007f583c51948d in clone () from /lib/libc.so.6
#12 0x0000000000000000 in ?? ()
Comment 6 Dario Andres 2010-01-13 20:04:50 UTC
@Niko: could you try to repeat the situation to check if the app crashes again ? Thanks
Comment 7 Niko Sams 2010-01-13 20:24:25 UTC
After updating kdelibs to trunk it seems to be fixed.
Sorry for the noise.