Skip to content

Screen: Fix `copyLineToStream` Qt6 assert

Dāvis Mosāns requested to merge davism/konsole:qt6 into master

Qt6 added assert for qBound when min > max.

This can happen if you try to select text that's after whitespace because then length will be before start causing negative max.

ASSERT: "!(max < min)" in file /usr/include/qt6/QtCore/qglobal.h, line 1032

#12 0x00007fd4990a44f8 in qt_assert (assertion=<optimized out>, file=<optimized out>, line=<optimized out>) at /usr/src/debug/qt6-base/qtbase-everywhere-src-6.4.2/src/corelib/global/qglobal.cpp:3276
#13 0x00007fd49a94816f in qBound<int> (min=@0x7ffcbc3f655c: 0, val=@0x7ffcbc3f651c: 104, max=@0x7ffcbc3f6580: -37) at /usr/include/qt6/QtCore/qglobal.h:1032
#14 0x00007fd49a964fb1 in Konsole::Screen::copyLineToStream (this=0x55a427710f60, line=2, start=56, count=104, decoder=0x7ffcbc3f66c0, appendNewLine=false, isBlockSelectionMode=false, options=...) at /mnt/KDE/konsole/src/Screen.cpp:2141
#15 0x00007fd49a9647bc in Konsole::Screen::writeToStream (this=0x55a427710f60, decoder=0x7ffcbc3f66c0, startIndex=376, endIndex=479, options=...) at /mnt/KDE/konsole/src/Screen.cpp:2009
#16 0x00007fd49a9645e1 in Konsole::Screen::text (this=0x55a427710f60, startIndex=376, endIndex=479, options=...) at /mnt/KDE/konsole/src/Screen.cpp:1976
#17 0x00007fd49a964418 in Konsole::Screen::selectedText (this=0x55a427710f60, options=...) at /mnt/KDE/konsole/src/Screen.cpp:1957
#18 0x00007fd49a977cfd in Konsole::ScreenWindow::selectedText (this=0x55a427aae2d0, options=...) at /mnt/KDE/konsole/src/ScreenWindow.cpp:120
#19 0x00007fd49aa22494 in Konsole::TerminalDisplay::copyToX11Selection (this=0x55a427901950) at /mnt/KDE/konsole/src/terminalDisplay/TerminalDisplay.cpp:2349
#20 0x00007fd49aa1d9fa in Konsole::TerminalDisplay::mouseReleaseEvent (this=0x55a427901950, ev=0x7ffcbc3f6fc0) at /mnt/KDE/konsole/src/terminalDisplay/TerminalDisplay.cpp:1496
#21 0x00007fd499fbd585 in QWidget::event (this=0x55a427901950, event=0x7ffcbc3f6fc0) at /usr/src/debug/qt6-base/qtbase-everywhere-src-6.4.2/src/widgets/kernel/qwidget.cpp:8848
#22 0x00007fd49aa24f33 in Konsole::TerminalDisplay::event (this=0x55a427901950, event=0x7ffcbc3f6fc0) at /mnt/KDE/konsole/src/terminalDisplay/TerminalDisplay.cpp:2871
#23 0x00007fd499f759bc in QApplicationPrivate::notify_helper (this=<optimized out>, receiver=0x55a427901950, e=0x7ffcbc3f6fc0) at /usr/src/debug/qt6-base/qtbase-everywhere-src-6.4.2/src/widgets/kernel/qapplication.cpp:3315
#24 0x00007fd499f6e3a9 in QApplication::notify (this=<optimized out>, receiver=<optimized out>, e=0x7ffcbc3f6fc0) at /usr/src/debug/qt6-base/qtbase-everywhere-src-6.4.2/src/widgets/kernel/qapplication.cpp:2803
#25 0x00007fd49912a258 in QCoreApplication::notifyInternal2 (receiver=0x55a427901950, event=0x7ffcbc3f6fc0) at /usr/src/debug/qt6-base/qtbase-everywhere-src-6.4.2/src/corelib/kernel/qcoreapplication.cpp:1026
#26 0x00007fd499f6acb9 in QApplicationPrivate::sendMouseEvent (receiver=0x55a427901950, event=0x7ffcbc3f6fc0, alienWidget=0x55a427901950, nativeWidget=0x55a4274538e0, buttonDown=<optimized out>, lastMouseReceiver=..., spontaneous=true, onlyDispatchEnterLeave=false) at /usr/src/debug/qt6-base/qtbase-everywhere-src-6.4.2/src/widgets/kernel/qapplication.cpp:2387
#27 0x00007fd499fcb7de in QWidgetWindow::handleMouseEvent (this=0x55a42755e9f0, event=0x7ffcbc3f7370) at /usr/src/debug/qt6-base/qtbase-everywhere-src-6.4.2/src/widgets/kernel/qwidgetwindow.cpp:623
#28 0x00007fd499fccad5 in QWidgetWindow::event (this=0x55a42755e9f0, event=0x7ffcbc3f7370) at /usr/src/debug/qt6-base/qtbase-everywhere-src-6.4.2/src/widgets/kernel/qwidgetwindow.cpp:241
#29 0x00007fd499f759bc in QApplicationPrivate::notify_helper (this=<optimized out>, receiver=0x55a42755e9f0, e=0x7ffcbc3f7370) at /usr/src/debug/qt6-base/qtbase-everywhere-src-6.4.2/src/widgets/kernel/qapplication.cpp:3315
#30 0x00007fd49912a258 in QCoreApplication::notifyInternal2 (receiver=0x55a42755e9f0, event=0x7ffcbc3f7370) at /usr/src/debug/qt6-base/qtbase-everywhere-src-6.4.2/src/corelib/kernel/qcoreapplication.cpp:1026
#31 0x00007fd49979a33c in QGuiApplicationPrivate::processMouseEvent (e=0x55a4278fafe0) at /usr/src/debug/qt6-base/qtbase-everywhere-src-6.4.2/src/gui/kernel/qguiapplication.cpp:2249
#32 0x00007fd4997f7465 in QWindowSystemInterface::sendWindowSystemEvents (flags=flags@entry=...) at /usr/src/debug/qt6-base/qtbase-everywhere-src-6.4.2/src/gui/kernel/qwindowsysteminterface.cpp:1103
#33 0x00007fd49350f3e0 in xcbSourceDispatch (source=<optimized out>) at /usr/src/debug/qt6-base/qtbase-everywhere-src-6.4.2/src/plugins/platforms/xcb/qxcbeventdispatcher.cpp:57
#34 0x00007fd49757982b in g_main_dispatch (context=0x7fd48c005040) at ../glib/glib/gmain.c:3454
#35 g_main_context_dispatch (context=0x7fd48c005040) at ../glib/glib/gmain.c:4172
#36 0x00007fd4975d0cc9 in g_main_context_iterate.constprop.0 (context=0x7fd48c005040, block=1, dispatch=1, self=<optimized out>) at ../glib/glib/gmain.c:4248
#37 0x00007fd4975780e2 in g_main_context_iteration (context=0x7fd48c005040, may_block=1) at ../glib/glib/gmain.c:4313
#38 0x00007fd49934d382 in QEventDispatcherGlib::processEvents (this=0x55a427425e10, flags=...) at /usr/src/debug/qt6-base/qtbase-everywhere-src-6.4.2/src/corelib/kernel/qeventdispatcher_glib.cpp:393
#39 0x00007fd499135604 in QEventLoop::exec (this=0x7ffcbc3f7820, flags=...) at /usr/src/debug/qt6-base/qtbase-everywhere-src-6.4.2/src/corelib/global/qflags.h:34
#40 0x00007fd49912ce7b in QCoreApplication::exec () at /usr/src/debug/qt6-base/qtbase-everywhere-src-6.4.2/src/corelib/global/qflags.h:74
#41 0x000055a4268f7ba2 in main (argc=1, argv=0x7ffcbc3f7be8) at /mnt/KDE/konsole/src/main.cpp:252

Merge request reports