SUMMARY Q_ASSERT(_currentTerminalDisplay) on Screen::setTextSelectionRendition() triggers on a newly opened konsole after Edit -> Select All. STEPS TO REPRODUCE 1. Launch a new Konsole. 2. Do NOT interact with the TerminalDisplay widget. 3. On the menubar, select "Edit" → "Select All". OBSERVED RESULT ASSERT: "_currentTerminalDisplay" in file /home/lj/src/term/konsole/src/Screen.cpp, line 658 Abortado Screen::_currentTerminalDisplay is not set until one of the following methods is called: TerminalDisplay::mousePressEvent() TerminalDisplay::wheelEvent() TerminalDisplay::keyPressEvent() Maybe Screen::_currentTerminalDisplay should be set on Session::addView() ?
It took a bit of trial and error to get it to crash. - open a konsole window - don't use the keyboard (using e.g. Alt+E to open the Edit menu means that setCurrentTerminalDisplay() is called from the keyPressEvent()) - don't move the mouse over the terminal area - move the mouse from the titlebar to the edit menu and "select all" then it crashes
I've created https://invent.kde.org/utilities/konsole/-/merge_requests/433 I don't see why setTerminalDisplay was being called in various places in the code, there is a reason, I just don't see it...
Moving the mouse shouldn't be a problem for reproducing the problem, as long as there are no button presses or wheel movement.
A possibly relevant merge request was started @ https://invent.kde.org/utilities/konsole/-/merge_requests/434
As for the reason setTerminalDisplay was being called in various places in the code, Vt102Emulation::sendKeyEvent() uses it to know if the session is read-only, and to call TerminalDisplay::scrollScreenWindow().
*** Bug 439626 has been marked as a duplicate of this bug. ***
Git commit 877a5128cb7cb3af51b9f9b360355bbb2a58269e by Kurt Hindenburg, on behalf of Luis Javier Merino Morán. Committed on 08/07/2021 at 20:42. Pushed by hindenburg into branch 'master'. Fix assert _currentTerminalDisplay in Screen::setTextSelectionRendition _currentTerminalDisplay was not set until some interaction was made with the TerminalDisplay widget. Set it as soon as Session->addView() is called. M +6 -0 src/Emulation.cpp M +6 -0 src/Emulation.h M +2 -0 src/session/Session.cpp M +0 -5 src/terminalDisplay/TerminalDisplay.cpp https://invent.kde.org/utilities/konsole/commit/877a5128cb7cb3af51b9f9b360355bbb2a58269e