https://bugs.kde.org/show_bug.cgi?id=525762

            Bug ID: 525762
           Summary: KDevelop crashes (abort) upon inserting a new line in
                    Vi mode
    Classification: Applications
           Product: kdevelop
      Version First 6.6.260801
       Reported In:
          Platform: Arch Linux
                OS: Linux
            Status: REPORTED
          Severity: crash
          Priority: NOR
         Component: All editors
          Assignee: [email protected]
          Reporter: [email protected]
  Target Milestone: ---

DESCRIPTION
Kdevelop aborts as soon as a new line is inserted in Vi mode when editing a .sh
file, it's unclear what other types of file reproduce this.

STEPS TO REPRODUCE
1. Create a .sh and open it with KDevelop (can be empty)
2. Switch to Vi mode
3. Press either "o" or "O" and observe a crash

OBSERVED RESULT
KDevelop aborts with the following message in console:
out of range line requested in text buffer (-1 out of [0, 529])

EXPECTED RESULT
Inserts a line without crashing

SOFTWARE/OS VERSIONS
Operating System (available in the Info Center app, or by running `kinfo` in a
terminal window): Arch Linux
KDE Plasma Version: 6.7.5
KDE Frameworks Version: 6.30.0
Qt Version: 6.11.2

ADDITIONAL INFORMATION
In KateBuffer::updateHighliting(), the following line passes invalid values to
doHighlight(), cause it to abort.
doHighlight(editingMinimalLineChanged(), editingMaximalLineChanged() + 1, true)

For some reason I didn't investigate further into, editingMinimalLineChanged()
is returning -1, which results in TextBuffer::blockForLine(-1) being called,
ultimately triggering the qFatal() in that function.

Backtrace below:
#0  __pthread_kill_implementation (threadid=<optimized out>,
signo=signo@entry=6, no_tid=no_tid@entry=0) at pthread_kill.c:44
#1  0x00007f59c749a243 in __pthread_kill_internal (threadid=<optimized out>,
signo=6) at pthread_kill.c:89
#2  0x00007f59c743e5d0 in __GI_raise (sig=sig@entry=6) at
../sysdeps/posix/raise.c:26
#3  0x00007f59c7425685 in __GI_abort () at abort.c:77
#4  0x00007f59c7c97369 in qAbort () at
/usr/src/debug/qt6-base/qtbase/src/corelib/global/qassert.cpp:47
#5  qt_maybe_message_fatal<QString&> (msgType=QtFatalMsg, context=...,
message=...) at
/usr/src/debug/qt6-base/qtbase/src/corelib/global/qlogging.cpp:2212
#6  qt_message(QtMsgType, const QMessageLogContext &, const char *, typedef
__va_list_tag __va_list_tag *) (msgType=msgType@entry=QtFatalMsg, context=..., 
    msg=msg@entry=0x7f59c57236e0 "out of range line requested in text buffer
(%d out of [0, %d])", ap=ap@entry=0x7ffcb5418148) at
/usr/src/debug/qt6-base/qtbase/src/corelib/global/qlogging.cpp:413
#7  0x00007f59c7c981a1 in QMessageLogger::fatal
(this=this@entry=0x7ffcb5418380, msg=msg@entry=0x7f59c57236e0 "out of range
line requested in text buffer (%d out of [0, %d])")
    at /usr/src/debug/qt6-base/qtbase/src/corelib/global/qlogging.cpp:902
#8  0x00007f59c54881bb in Kate::TextBuffer::blockForLine
(this=this@entry=0x55b75b6f62e0, line=line@entry=-1) at
/usr/src/debug/ktexteditor/ktexteditor-6.30.0/src/buffer/katetextbuffer.cpp:513
#9  0x00007f59c548ff51 in Kate::TextBuffer::setLineMetaData
(this=0x55b75b6f62e0, line=-1, textLine=...) at
/usr/src/debug/ktexteditor/ktexteditor-6.30.0/src/buffer/katetextbuffer.cpp:207
#10 0x00007f59c5534394 in KateBuffer::doHighlight (this=0x55b75b6f62e0,
startLine=<optimized out>, endLine=0, invalidate=true) at
/usr/src/debug/ktexteditor/ktexteditor-6.30.0/src/document/katebuffer.cpp:355
#11 0x00007f59c5509327 in operator() (__closure=<synthetic pointer>, c=...) at
/usr/src/debug/ktexteditor/ktexteditor-6.30.0/src/document/katedocument.cpp:3375
#12 KTextEditor::DocumentPrivate::newLine (this=0x55b75b2fae20,
v=0x55b75b8e5650, indent=KTextEditor::DocumentPrivate::Indent,
newLinePos=KTextEditor::DocumentPrivate::Normal)
    at
/usr/src/debug/ktexteditor/ktexteditor-6.30.0/src/document/katedocument.cpp:3428
#13 0x00007f59c56d4b91 in KateVi::NormalViMode::commandOpenNewLineOver
(this=0x55b75b87ad30) at
/usr/src/debug/ktexteditor/ktexteditor-6.30.0/src/view/kateview.h:800
#14 0x00007f59c56d102a in KateVi::Command::execute (this=0x55b75bbc13d8,
mode=0x55b75b87ad30) at
/usr/src/debug/ktexteditor/ktexteditor-6.30.0/src/vimode/command.cpp:21
#15 KateVi::NormalViMode::executeCommand (this=0x55b75b87ad30,
cmd=0x55b75bbc13d8) at
/usr/src/debug/ktexteditor/ktexteditor-6.30.0/src/vimode/modes/normalvimode.cpp:453
#16 0x00007f59c56d31fd in KateVi::NormalViMode::handleKeypress
(this=0x55b75b87ad30, e=0x7ffcb5419000) at
/usr/src/debug/ktexteditor/ktexteditor-6.30.0/src/vimode/modes/normalvimode.cpp:379
#17 0x00007f59c56f43da in KateVi::InputModeManager::handleKeypress
(this=<optimized out>, e=0x7ffcb5419000) at
/usr/src/debug/ktexteditor/ktexteditor-6.30.0/src/vimode/inputmodemanager.cpp:141
#18 0x00007f59c56bd590 in KateViInputMode::keyPress (this=0x55b75b8ad280,
e=<optimized out>) at
/usr/src/debug/ktexteditor/ktexteditor-6.30.0/src/inputmode/kateviinputmode.cpp:289
#19 0x00007f59c561b1d8 in KateViewInternal::keyPressEvent (this=0x55b75b82da00,
e=0x7ffcb5419000) at
/usr/src/debug/ktexteditor/ktexteditor-6.30.0/src/view/kateviewinternal.cpp:3184
#20 0x00007f59c560cb1f in KateViewInternal::eventFilter (this=0x55b75b82da00,
obj=0x55b75b82da00, e=0x7ffcb5419000) at
/usr/src/debug/ktexteditor/ktexteditor-6.30.0/src/view/kateviewinternal.cpp:3056
#21 0x00007f59c7d8184c in
QCoreApplicationPrivate::sendThroughObjectEventFilters (receiver=<optimized
out>, event=<optimized out>) at
/usr/src/debug/qt6-base/qtbase/src/corelib/kernel/qcoreapplication.cpp:1263
#22 QCoreApplicationPrivate::sendThroughObjectEventFilters
(receiver=receiver@entry=0x55b75b82da00, event=event@entry=0x7ffcb5419000) at
/usr/src/debug/qt6-base/qtbase/src/corelib/kernel/qcoreapplication.cpp:1252
#23 0x00007f59c910324e in QApplicationPrivate::notify_helper
(this=this@entry=0x55b7597d7000, receiver=receiver@entry=0x55b75b82da00,
e=e@entry=0x7ffcb5419000) at
/usr/src/debug/qt6-base/qtbase/src/widgets/kernel/qapplication.cpp:3267
#24 0x00007f59c9104f72 in QApplication::notify (this=0x7ffcb54199c0,
receiver=<optimized out>, e=<optimized out>) at
/usr/src/debug/qt6-base/qtbase/src/widgets/kernel/qapplication.cpp:2694
#25 0x00007f59c7d822b8 in QCoreApplication::notifyInternal2
(receiver=0x55b75b82da00, event=0x7ffcb5419000) at
/usr/src/debug/qt6-base/qtbase/src/corelib/kernel/qcoreapplication.cpp:1126
#26 0x00007f59c7d822ea in QCoreApplication::forwardEvent (receiver=<optimized
out>, event=<optimized out>, originatingEvent=<optimized out>) at
/usr/src/debug/qt6-base/qtbase/src/corelib/kernel/qcoreapplication.cpp:1141
#27 0x00007f59c91815bb in QWidgetWindow::handleGestureEvent (this=<optimized
out>, e=<optimized out>) at
/usr/src/debug/qt6-base/qtbase/src/widgets/kernel/qwidgetwindow.cpp:1203
#28 QWidgetWindow::event (this=<optimized out>, event=0x7ffcb5419000) at
/usr/src/debug/qt6-base/qtbase/src/widgets/kernel/qwidgetwindow.cpp:364
#29 0x00007f59c910325f in QApplicationPrivate::notify_helper (this=<optimized
out>, receiver=0x55b7597e58e0, e=0x7ffcb5419000) at
/usr/src/debug/qt6-base/qtbase/src/widgets/kernel/qapplication.cpp:3273
#30 0x00007f59c7d822b8 in QCoreApplication::notifyInternal2
(receiver=0x55b7597e58e0, event=0x7ffcb5419000) at
/usr/src/debug/qt6-base/qtbase/src/corelib/kernel/qcoreapplication.cpp:1126
#31 0x00007f59c7d8230d in QCoreApplication::sendSpontaneousEvent
(receiver=<optimized out>, event=<optimized out>) at
/usr/src/debug/qt6-base/qtbase/src/corelib/kernel/qcoreapplication.cpp:1585
#32 0x00007f59c87b25f0 in QGuiApplicationPrivate::processKeyEvent
(e=0x55b75bb6adc0) at
/usr/src/debug/qt6-base/qtbase/src/gui/kernel/qguiapplication.cpp:2639
#33 0x00007f59c8830d3b in QWindowSystemInterface::sendWindowSystemEvents
(flags=...) at
/usr/src/debug/qt6-base/qtbase/src/gui/kernel/qwindowsysteminterface.cpp:1117
#34 0x00007f59c8d7be74 in userEventSourceDispatch (source=<optimized out>) at
/usr/src/debug/qt6-base/qtbase/src/gui/platform/unix/qeventdispatcher_glib.cpp:39
#35 0x00007f59c2e83c76 in g_main_dispatch (context=0x7f5998000f00) at
../glib/glib/gmain.c:3591
#36 0x00007f59c2e85ed7 in g_main_context_dispatch_unlocked
(context=0x7f5998000f00) at ../glib/glib/gmain.c:4451
#37 g_main_context_iterate_unlocked (context=context@entry=0x7f5998000f00,
block=block@entry=1, dispatch=dispatch@entry=1, self=<optimized out>) at
../glib/glib/gmain.c:4516
#38 0x00007f59c2e86055 in g_main_context_iteration (context=0x7f5998000f00,
may_block=1) at ../glib/glib/gmain.c:4582
#39 0x00007f59c8096f32 in QEventDispatcherGlib::processEvents
(this=0x55b7597d8830, flags=...) at
/usr/src/debug/qt6-base/qtbase/src/corelib/kernel/qeventdispatcher_glib.cpp:402
#40 0x00007f59c7d8f664 in QEventLoop::processEvents (this=0x7ffcb5419350,
flags=...) at
/usr/src/debug/qt6-base/qtbase/src/corelib/kernel/qeventloop.cpp:109
#41 QEventLoop::exec (this=0x7ffcb5419350, flags=...) at
/usr/src/debug/qt6-base/qtbase/src/corelib/kernel/qeventloop.cpp:198
#42 0x00007f59c7d8685a in QCoreApplication::exec () at
/usr/src/debug/qt6-base/qtbase/src/corelib/kernel/qcoreapplication.cpp:1469
#43 0x00007f59c90ffb7a in QApplication::exec () at
/usr/src/debug/qt6-base/qtbase/src/widgets/kernel/qapplication.cpp:2543
#44 0x000055b736c61093 in main (argc=<optimized out>, argv=<optimized out>) at
/usr/src/debug/kdevelop/kdevelop-26.08.1/app/main.cpp:836

-- 
You are receiving this mail because:
You are watching all bug changes.

Reply via email to