Bug 467790

Summary: Crashes every time I clear scrollback and reset
Product: [Applications] konsole Reporter: Aaron Williams <aaronw>
Component: historyAssignee: Konsole Developer <konsole-devel>
Status: RESOLVED FIXED    
Severity: crash CC: aaronw
Priority: NOR    
Version: 23.03.80   
Target Milestone: ---   
Platform: openSUSE   
OS: Linux   
Latest Commit: Version Fixed In:
Sentry Crash Report:
Attachments: konsolerc configuration file.
Session that crashed (all crash)
Default Profile I use
konsoleui file

Description Aaron Williams 2023-03-25 19:20:56 UTC
SUMMARY
***
NOTE: If you are reporting a crash, please try to attach a backtrace with debug symbols.
See https://community.kde.org/Guidelines_and_HOWTOs/Debugging/How_to_create_useful_crash_reports
***
I have Ctrl+Shift+K set up to clear scrollback and reset.

STEPS TO REPRODUCE
1. Open Konsole
2. Type <Ctrl>+<Shift>+k
3. Watch it crash

OBSERVED RESULT
Crash

EXPECTED RESULT
This used to work.

SOFTWARE/OS VERSIONS
Windows: 
macOS: 
Linux/KDE Plasma: OpenSUSE 15.4
(available in About System)
KDE Plasma Version: 5.27.3
KDE Frameworks Version: 5.104.0
Qt Version: 5.15.8

ADDITIONAL INFORMATION
I did see some strange behavior. When I logged in after the last update some of my konsole settings seem to have changed. The menu bar disappeared and the tabs moved from the bottom to the top.
I was able to fix this, however.

Application: Konsole (konsole), signal: Segmentation fault
Content of s_kcrashErrorMessage: std::unique_ptr<char []> = {get() = 0x0}
[KCrash Handler]
#6  Konsole::SessionController::updateCodecAction (this=0x561189c533a0, codec=0x0) at /usr/src/debug/konsole-23.03.80-lp154.1.1.x86_64/src/session/SessionController.cpp:996
#7  0x00007f634ca5da3b in QtPrivate::QSlotObjectBase::call (a=0x7ffe0b0db070, r=0x561189c533a0, this=<optimized out>) at ../../include/QtCore/../../src/corelib/kernel/qobjectdefs_impl.h:398
#8  doActivate<false> (sender=0x561189e639c0, signal_index=8, argv=0x7ffe0b0db070) at kernel/qobject.cpp:3923
#9  0x00007f634ca56eb2 in QMetaObject::activate (sender=sender@entry=0x561189e639c0, m=m@entry=0x7f634de4d3c0 <Konsole::Session::staticMetaObject>, local_signal_index=local_signal_index@entry=5, argv=argv@entry=0x7ffe0b0db070) at kernel/qobject.cpp:3983
#10 0x00007f634dce9422 in Konsole::Session::sessionCodecChanged (this=this@entry=0x561189e639c0, _t1=<optimized out>) at /usr/src/debug/konsole-23.03.80-lp154.1.1.x86_64/build/src/konsoleprivate_autogen/ZNMSKYHDQK/moc_Session.cpp:737
#11 0x00007f634dd9ee34 in Konsole::Session::setCodec (this=this@entry=0x561189e639c0, codec=<optimized out>) at /usr/src/debug/konsole-23.03.80-lp154.1.1.x86_64/src/session/Session.cpp:234
#12 0x00007f634ddad54c in Konsole::SessionController::clearHistoryAndReset (this=0x561189c533a0) at /usr/src/debug/konsole-23.03.80-lp154.1.1.x86_64/src/session/SessionController.cpp:1805
#13 0x00007f634ca5da3b in QtPrivate::QSlotObjectBase::call (a=0x7ffe0b0db200, r=0x561189c533a0, this=<optimized out>) at ../../include/QtCore/../../src/corelib/kernel/qobjectdefs_impl.h:398
#14 doActivate<false> (sender=0x561189c78c00, signal_index=4, argv=0x7ffe0b0db200) at kernel/qobject.cpp:3923
#15 0x00007f634ca56eb2 in QMetaObject::activate (sender=sender@entry=0x561189c78c00, m=m@entry=0x7f634db7cd40 <QAction::staticMetaObject>, local_signal_index=local_signal_index@entry=1, argv=argv@entry=0x7ffe0b0db200) at kernel/qobject.cpp:3983
#16 0x00007f634d68cf82 in QAction::triggered (this=this@entry=0x561189c78c00, _t1=<optimized out>) at .moc/moc_qaction.cpp:376
#17 0x00007f634d68f5cc in QAction::activate (this=0x561189c78c00, event=<optimized out>) at kernel/qaction.cpp:1161
#18 0x00007f634d68ff61 in QAction::event (this=<optimized out>, e=<optimized out>) at kernel/qaction.cpp:1086
#19 0x00007f634d69353c in QApplicationPrivate::notify_helper (this=this@entry=0x561189771dc0, receiver=receiver@entry=0x561189c78c00, e=e@entry=0x7ffe0b0db560) at kernel/qapplication.cpp:3640
#20 0x00007f634d69a2ff in QApplication::notify (this=<optimized out>, receiver=0x561189c78c00, e=0x7ffe0b0db560) at kernel/qapplication.cpp:3164
#21 0x00007f634ca20043 in QCoreApplication::notifyInternal2 (receiver=0x561189c78c00, event=0x7ffe0b0db560) at kernel/qcoreapplication.cpp:1064
#22 0x00007f634cf6cac6 in QShortcutMap::dispatchEvent (this=this@entry=0x561189771e88, e=e@entry=0x7ffe0b0db620) at kernel/qshortcutmap.cpp:675
#23 0x00007f634cf6d53a in QShortcutMap::tryShortcut (this=this@entry=0x561189771e88, e=e@entry=0x7ffe0b0db620) at kernel/qshortcutmap.cpp:343
#24 0x00007f634cf19503 in QWindowSystemInterface::handleShortcutEvent (window=<optimized out>, window@entry=0x561189abacb0, timestamp=224004209, keyCode=75, modifiers=..., nativeScanCode=45, nativeVirtualKey=75, nativeModifiers=21, text=..., autorepeat=false, count=1) at kernel/qwindowsysteminterface.cpp:477
#25 0x00007f634cf3a687 in QGuiApplicationPrivate::processKeyEvent (e=0x561189e53fa0) at kernel/qguiapplication.cpp:2398
#26 0x00007f634cf3f075 in QGuiApplicationPrivate::processWindowSystemEvent (e=e@entry=0x561189e53fa0) at kernel/qguiapplication.cpp:2011
#27 0x00007f634cf15b8b in QWindowSystemInterface::sendWindowSystemEvents (flags=flags@entry=...) at kernel/qwindowsysteminterface.cpp:1169
#28 0x00007f633fbf665a in xcbSourceDispatch (source=<optimized out>) at qxcbeventdispatcher.cpp:105
#29 0x00007f63489fa82b in g_main_dispatch (context=0x561189785b00) at ../glib/gmain.c:3381
#30 g_main_context_dispatch (context=context@entry=0x561189785b00) at ../glib/gmain.c:4099
#31 0x00007f63489fabd0 in g_main_context_iterate (context=context@entry=0x561189785b00, block=block@entry=1, dispatch=dispatch@entry=1, self=<optimized out>) at ../glib/gmain.c:4175
#32 0x00007f63489fac5c in g_main_context_iteration (context=0x561189785b00, may_block=may_block@entry=1) at ../glib/gmain.c:4240
#33 0x00007f634ca8298c in QEventDispatcherGlib::processEvents (this=0x561189959100, flags=...) at kernel/qeventdispatcher_glib.cpp:423
#34 0x00007f634ca1e8aa in QEventLoop::exec (this=this@entry=0x7ffe0b0db9d0, flags=..., flags@entry=...) at kernel/qeventloop.cpp:235
#35 0x00007f634ca280e7 in QCoreApplication::exec () at kernel/qcoreapplication.cpp:1375
#36 0x00007f634cf32a7c in QGuiApplication::exec () at kernel/qguiapplication.cpp:1870
#37 0x00007f634d693495 in QApplication::exec () at kernel/qapplication.cpp:2832
#38 0x0000561187b39fb4 in main (argc=<optimized out>, argv=<optimized out>) at /usr/src/debug/konsole-23.03.80-lp154.1.1.x86_64/src/main.cpp:271
[Inferior 1 (process 1669042) detached]
Comment 1 Aaron Williams 2023-03-25 19:24:34 UTC
Created attachment 157574 [details]
konsolerc configuration file.
Comment 2 Aaron Williams 2023-03-25 19:26:16 UTC
Created attachment 157575 [details]
Session that crashed (all crash)
Comment 3 Aaron Williams 2023-03-25 19:28:06 UTC
Created attachment 157576 [details]
Default Profile I use
Comment 4 Aaron Williams 2023-03-25 19:28:35 UTC
Created attachment 157577 [details]
konsoleui file
Comment 5 Aaron Williams 2023-03-25 19:53:31 UTC
It looks like it's crashing here in session/SessionController.cpp:
994     void SessionController::updateCodecAction(QTextCodec *codec)
995     {
996         _codecAction->setCurrentCodec(QString::fromUtf8(codec->name()));
997     }
998
codec is NULL in gdb.

Note that I am seeing a crash in the same place when I attempt to switch my profile, no matter what profile I select. I can, however, create a new tab and duplicate a tab.
Changing the character encoding also causes a trap when I attempt to change from UTF-8 to default. Again, the crash is in the same place. I do not know enough about Konsole to know why the name appears to be NULL.
Comment 6 Aaron Williams 2023-03-25 20:15:25 UTC
With some more digging it looks like it was due to the parent pointing to a non-existent profile in Shell.profile.
I was getting the following message when starting Konsole:
 
 org.kde.konsole.profile: Could not load profile from  "/home/aaronw/.kde4/share/apps/konsole/.profile"

After manually removing the parent line in Shell.profile it seems to have stopped crashing. It still may be a bug, though, since it should not crash. Probably since I have a lot of cruft going back well over a decade floating around my home directory.
Comment 7 Bug Janitor Service 2023-04-28 21:47:35 UTC
A possibly relevant merge request was started @ https://invent.kde.org/utilities/konsole/-/merge_requests/849
Comment 8 Kurt Hindenburg 2023-05-02 00:12:08 UTC
Git commit 9aef76a028eaf9c498761fc6ba487970e5a7af13 by Kurt Hindenburg, on behalf of Kurt Hindenburg.
Committed on 02/05/2023 at 00:06.
Pushed by hindenburg into branch 'master'.

Do not allow an invalid parent to be set in profiles

There are numerous crashes that come from this.

M  +6    -1    src/profile/ProfileManager.cpp

https://invent.kde.org/utilities/konsole/commit/9aef76a028eaf9c498761fc6ba487970e5a7af13