Bug 426242

Summary: assert in Konsole::Screen::copyLineToStream
Product: [Applications] konsole Reporter: Martin Sandsmark <martin.sandsmark>
Component: generalAssignee: Konsole Developer <konsole-devel>
Status: RESOLVED DUPLICATE    
Severity: crash    
Priority: NOR    
Version: master   
Target Milestone: ---   
Platform: Compiled Sources   
OS: Linux   
Latest Commit: Version Fixed In:

Description Martin Sandsmark 2020-09-06 11:34:57 UTC
At fc35d8345b2e8e77d35fbde2a38bb1cb79a7c247.

I'm not 100% sure what I was doing when it happened, I think I hit the mouse button while pressing some unknown key.

Interesting part of stack trace:
#0  0x00007f229989c615 in raise () from /usr/lib/libc.so.6
#1  0x00007f2299885862 in abort () from /usr/lib/libc.so.6
#2  0x00007f2299ab99ac in QMessageLogger::fatal(char const*, ...) const () from /usr/lib/libQt5Core.so.5
#3  0x00007f2299ab8d59 in qt_assert(char const*, char const*, int) () from /usr/lib/libQt5Core.so.5
#4  0x00007f2295c6c837 in Konsole::Screen::copyLineToStream (this=0x557577c178c0, line=<optimized out>,
    start=21, count=1, decoder=0x7ffefe53ea30, appendNewLine=<optimized out>, options=...)
    at /usr/include/qt/QtCore/qvector.h:478
#5  0x00007f2295c9481f in Konsole::Screen::writeToStream (this=0x557577c178c0, decoder=0x7ffefe53ea30,
    startIndex=<optimized out>, endIndex=<optimized out>, options=...)
    at /usr/src/debug/konsole/src/Screen.cpp:1297
#6  0x00007f2295c960c2 in Konsole::Screen::text (this=this@entry=0x557577c178c0, startIndex=34599,
    endIndex=34599, options=options@entry=...) at /usr/src/debug/konsole/src/Screen.cpp:1262
#7  0x00007f2295c961d3 in Konsole::Screen::selectedText (this=0x557577c178c0, options=options@entry=...)
    at /usr/src/debug/konsole/src/Screen.cpp:1243
#8  0x00007f2295c7eadf in Konsole::Emulation::checkSelectedText (this=0x55757783e710)
    at /usr/include/qt/QtCore/qflags.h:121
#9  0x00007f2299d12a26 in ?? () from /usr/lib/libQt5Core.so.5
#10 0x00007f2295ce2c45 in Konsole::TerminalDisplay::extendSelection (this=this@entry=0x5575779f2f90,
    position=...) at /usr/include/qt/QtCore/qpoint.h:133
#11 0x00007f2295ce6ccd in Konsole::TerminalDisplay::mousePressEvent (this=0x5575779f2f90, ev=0x7ffefe53f3c0)
    at /usr/include/qt/QtCore/qpoint.h:124
#12 0x00007f22990d4c7e in QWidget::event(QEvent*) () from /usr/lib/libQt5Widgets.so.5

The assert hit is in QVector<T>::remove(int i, int n), so this probably leads to a segfault without asserts enabled.

Variables available at "int copied = copyLineToStream([...]" in Screen::writeToStream():
count = 1
decoder = (Konsole::TerminalCharacterDecoder *) 0x7ffefe53ea30
appendNewLine = false
options = options (PreserveLineBreaks)

In copyLineToStream:
start = 21
lineLength = 113
screenLine = 306 (so we are in the not 'line < _history->getLines()' branch)
length = optimized out (which could mean we're after where it is defined, maybe)
data = optimized out
i = not in current context (so not in any of the for loops)


The confusing thing is, though, that I can't find any QVectors in that scope, much less any code calling QVector::remove().
Comment 1 Martin Sandsmark 2020-09-06 11:50:18 UTC
Seems like it is https://bugs.kde.org/show_bug.cgi?id=398320 that has gotten re-introduced somehow.

*** This bug has been marked as a duplicate of bug 398320 ***