Bug 472230 - Kate crashed when switching files with Ctrl+Tab
Summary: Kate crashed when switching files with Ctrl+Tab
Status: RESOLVED WORKSFORME
Alias: None
Product: kate
Classification: Applications
Component: general (show other bugs)
Version: 23.04.3
Platform: Arch Linux Linux
: NOR crash
Target Milestone: ---
Assignee: KWrite Developers
URL:
Keywords: drkonqi
: 475614 478810 (view as bug list)
Depends on:
Blocks:
 
Reported: 2023-07-13 16:42 UTC by Aidan Coombs
Modified: 2024-04-14 03:47 UTC (History)
5 users (show)

See Also:
Latest Commit:
Version Fixed In:


Attachments
New crash information added by DrKonqi (4.33 KB, text/plain)
2023-08-17 08:27 UTC, Danang Rahmatullah
Details
Kate crash logs from journalctl (31.65 KB, text/plain)
2023-08-18 07:19 UTC, Danang Rahmatullah
Details

Note You need to log in before you can comment on or make changes to this bug.
Description Aidan Coombs 2023-07-13 16:42:20 UTC
Application: kate (23.04.3)

Qt Version: 5.15.10
Frameworks Version: 5.108.0
Operating System: Linux 6.4.2-zen1-1-zen x86_64
Windowing System: X11
Distribution: Arch Linux
DrKonqi: 5.27.6 [KCrashBackend]

-- Information about the crash:
BACKGROUND
I was editing a hitherto unsaved file, compiling various copy-pasted lines from my systemd journal to help me debug a recurring issue I have. I saved the first file as a .txt, edited it a bit more, then saved it once more.
STEPS TO REPRODUCE
Method A
1. Create and save the file as described above.
2. Use Ctrl+N to create a new file.
3. Use Alt+Tab to repeatedly switch between Kate and another application, pasting one block of text into Kate each time you switch to it.
4. Without saving the second file, press Ctrl+Tab to switch to the first file.
Method B
1. Open Kate. Use Ctrl+O to open a plain text document, like the one above.
2. Use Ctrl+N to create a new file.
3. Have a number (I had 17) of text blocks of varying length on your clipboard.
4. Open the KDE Clipboard plasmoid. Use the relevant button to keep it open, even when it loses focus.
5. Click on the lowest (oldest/least recently used) block in the Clipboard plasmoid. Click in the Kate window and press Ctrl+V, then you can type a bit (e.g., pressing Enter to insert space between the pasted blocks). Repeat until you have pasted all blocks in the clipboard history.
6. Without saving the second file, press Ctrl+Tab to switch to the first file.
EXPECTED BEHAVIOUR
Kate shows the first file.
ACTUAL BEHAVIOUR
Kate immediately crashed without showing the first file. I don't know what would happen if I held Ctrl+Tab for longer, but I would guess that the crash occurred when I let go of both keys rather than when I pressed them.
NOTES
I have had trouble reproducing this bug. After it originally occurred (method A), I restarted Kate and used procedure B to reproduce it successfully. However, in attempts since then, I have failed to reproduce the bug. 
Things I Did That Might Have Stuffed Things Up (workarounds?)
I copied the entire file after assembling it in Kate so I could reassemble it easily after the crash. I also tried copying each block out-of-order, messing up their chronological sorting, and killing a number of processes I found with the command `kate -b --tempfile` before relaunching Kate. The crash has not reoccurred since then.

The crash can be reproduced sometimes.

-- Backtrace:
Application: Kate (kate), signal: Segmentation fault
Content of s_kcrashErrorMessage: std::unique_ptr<char []> = {get() = <optimized out>}
[KCrash Handler]
#6  std::__uniq_ptr_impl<QTLWExtra, std::default_delete<QTLWExtra> >::_M_ptr() const (this=0x28, this=<optimized out>) at /usr/include/c++/13.1.1/bits/unique_ptr.h:199
#7  std::unique_ptr<QTLWExtra, std::default_delete<QTLWExtra> >::get() const (this=0x28, this=<optimized out>) at /usr/include/c++/13.1.1/bits/unique_ptr.h:470
#8  std::unique_ptr<QTLWExtra, std::default_delete<QTLWExtra> >::operator bool() const (this=0x28) at /usr/include/c++/13.1.1/bits/unique_ptr.h:487
#9  QWidget::windowIcon() const (this=<optimized out>) at kernel/qwidget.cpp:5976
#10 0x00007f7efbf0c3c7 in detail::FilenameListItem::icon() const (this=<optimized out>) at /usr/src/debug/kate/kate-23.04.3/addons/tabswitcher/tabswitcherfilesmodel.cpp:31
#11 detail::TabswitcherFilesModel::data(QModelIndex const&, int) const (this=<optimized out>, index=<optimized out>, role=<optimized out>) at /usr/src/debug/kate/kate-23.04.3/addons/tabswitcher/tabswitcherfilesmodel.cpp:219
#12 0x00007f7f10002dce in QModelIndex::data(int) const (arole=1, this=0x7ffe36a68bf0) at ../../include/QtCore/../../src/corelib/itemmodels/qabstractitemmodel.h:460
#13 QStyledItemDelegate::initStyleOption(QStyleOptionViewItem*, QModelIndex const&) const (this=0x556743dc8980, option=0x7ffe36a68aa0, index=...) at itemviews/qstyleditemdelegate.cpp:302
#14 0x00007f7f10006d43 in QStyledItemDelegate::sizeHint(QStyleOptionViewItem const&, QModelIndex const&) const (this=0x556743dc8980, option=..., index=...) at itemviews/qstyleditemdelegate.cpp:410
#15 0x00007f7f10053575 in QTreeView::indexRowSizeHint(QModelIndex const&) const (this=<optimized out>, index=<optimized out>) at itemviews/qtreeview.cpp:3005
#16 0x00007f7f10053745 in QTreeViewPrivate::itemHeight(int) const (item=0, this=0x556743b96220) at itemviews/qtreeview.cpp:3482
#17 QTreeViewPrivate::itemHeight(int) const (this=this@entry=0x556743b96220, item=item@entry=2) at itemviews/qtreeview.cpp:3470
#18 0x00007f7f100577ac in QTreeViewPrivate::updateScrollBars() (this=0x556743b96220) at itemviews/qtreeview.cpp:3722
#19 0x00007f7f10057ae8 in QTreeView::updateGeometries() (this=0x556743d51920) at itemviews/qtreeview.cpp:2844
#20 0x00007f7f0ffdb7e1 in QAbstractItemView::doItemsLayout() (this=0x556743d51920) at itemviews/qabstractitemview.cpp:1232
#21 0x00007f7f1004cb63 in QTreeView::doItemsLayout() (this=0x556743d51920) at itemviews/qtreeview.cpp:2103
#22 0x00007f7f10054a42 in QAbstractItemViewPrivate::executePostedLayout() const (this=0x556743b96220) at ../../include/QtWidgets/5.15.10/QtWidgets/private/../../../../../src/widgets/itemviews/qabstractitemview_p.h:94
#23 QAbstractItemViewPrivate::executePostedLayout() const (this=0x556743b96220) at ../../include/QtWidgets/5.15.10/QtWidgets/private/../../../../../src/widgets/itemviews/qabstractitemview_p.h:226
#24 QTreeView::sizeHintForColumn(int) const (this=0x556743d51920, column=0) at itemviews/qtreeview.cpp:2867
#25 0x00007f7efbf0a9e5 in TabSwitcherTreeView::sizeHintWidth() const (this=0x556743d51920) at /usr/src/debug/kate/kate-23.04.3/addons/tabswitcher/tabswitchertreeview.cpp:28
#26 TabSwitcherPluginView::updateViewGeometry() (this=0x55674385b6d0) at /usr/src/debug/kate/kate-23.04.3/addons/tabswitcher/tabswitcher.cpp:252
#27 TabSwitcherPluginView::walk(int, int) (this=this@entry=0x55674385b6d0, from=from@entry=0, to=<optimized out>) at /usr/src/debug/kate/kate-23.04.3/addons/tabswitcher/tabswitcher.cpp:206
#28 0x00007f7efbf0ad8c in TabSwitcherPluginView::walkForward() (this=0x55674385b6d0) at /usr/src/debug/kate/kate-23.04.3/addons/tabswitcher/tabswitcher.cpp:227
#29 0x00007f7f0f0d06a7 in QtPrivate::QSlotObjectBase::call(QObject*, void**) (a=0x7ffe36a69200, r=<optimized out>, this=0x556743da01f0, this=<optimized out>, r=<optimized out>, a=<optimized out>) at ../../include/QtCore/../../src/corelib/kernel/qobjectdefs_impl.h:398
#30 doActivate<false>(QObject*, int, void**) (sender=0x556743dc9560, signal_index=4, argv=0x7ffe36a69200) at kernel/qobject.cpp:3925
#31 0x00007f7f0fd6bbb7 in QAction::triggered(bool) (this=this@entry=0x556743dc9560, _t1=<optimized out>) at .moc/moc_qaction.cpp:376
#32 0x00007f7f0fd7160b in QAction::activate(QAction::ActionEvent) (this=0x556743dc9560, event=<optimized out>) at kernel/qaction.cpp:1161
#33 0x00007f7f0fd716de in QAction::event(QEvent*) (e=<optimized out>, this=<optimized out>) at kernel/qaction.cpp:1086
#34 QAction::event(QEvent*) (this=<optimized out>, e=<optimized out>) at kernel/qaction.cpp:1075
#35 0x00007f7f0fd7893f in QApplicationPrivate::notify_helper(QObject*, QEvent*) (this=<optimized out>, receiver=0x556743dc9560, e=0x7ffe36a69390) at kernel/qapplication.cpp:3640
#36 0x00007f7f0f09b778 in QCoreApplication::notifyInternal2(QObject*, QEvent*) (receiver=0x556743dc9560, event=0x7ffe36a69390) at kernel/qcoreapplication.cpp:1064
#37 0x00007f7f0f09b7e3 in QCoreApplication::sendEvent(QObject*, QEvent*) (receiver=<optimized out>, event=<optimized out>) at kernel/qcoreapplication.cpp:1462
#38 0x00007f7f0f577016 in QShortcutMap::dispatchEvent(QKeyEvent*) (this=this@entry=0x556743098e58, e=e@entry=0x7ffe36a69450) at kernel/qshortcutmap.cpp:675
#39 0x00007f7f0f577405 in QShortcutMap::tryShortcut(QKeyEvent*) (this=0x556743098e58, e=0x7ffe36a69450) at kernel/qshortcutmap.cpp:343
#40 0x00007f7f0f52be38 in QWindowSystemInterface::handleShortcutEvent(QWindow*, unsigned long, int, QFlags<Qt::KeyboardModifier>, unsigned int, unsigned int, unsigned int, QString const&, bool, unsigned short) (window=<optimized out>, timestamp=14884617, keyCode=16777217, modifiers=..., nativeScanCode=23, nativeVirtualKey=65289, nativeModifiers=4, text=..., autorepeat=false, count=1) at kernel/qwindowsysteminterface.cpp:477
#41 0x00007f7f0f545542 in QGuiApplicationPrivate::processKeyEvent(QWindowSystemInterfacePrivate::KeyEvent*) (e=0x7ffe36a695f0) at kernel/qguiapplication.cpp:2398
#42 0x00007f7f0969a995 in QIBusPlatformInputContext::filterEventFinished(QDBusPendingCallWatcher*) (this=<optimized out>, call=0x556744e444e0) at /usr/src/debug/qt5-base/qtbase/src/plugins/platforminputcontexts/ibus/qibusplatforminputcontext.cpp:517
#43 0x00007f7f0f0d06a7 in QtPrivate::QSlotObjectBase::call(QObject*, void**) (a=0x7ffe36a69780, r=<optimized out>, this=0x556744e1edd0, this=<optimized out>, r=<optimized out>, a=<optimized out>) at ../../include/QtCore/../../src/corelib/kernel/qobjectdefs_impl.h:398
#44 doActivate<false>(QObject*, int, void**) (sender=0x556744e444e0, signal_index=3, argv=0x7ffe36a69780) at kernel/qobject.cpp:3925
#45 0x00007f7f0fbd6ad4 in QDBusPendingCallWatcher::finished(QDBusPendingCallWatcher*) (this=<optimized out>, _t1=<optimized out>) at .moc/moc_qdbuspendingcall.cpp:158
#46 0x00007f7f0f0c31e4 in QObject::event(QEvent*) (this=0x556744e444e0, e=0x556743b4db20) at kernel/qobject.cpp:1347
#47 0x00007f7f0fd7893f in QApplicationPrivate::notify_helper(QObject*, QEvent*) (this=<optimized out>, receiver=0x556744e444e0, e=0x556743b4db20) at kernel/qapplication.cpp:3640
#48 0x00007f7f0f09b778 in QCoreApplication::notifyInternal2(QObject*, QEvent*) (receiver=0x556744e444e0, event=0x556743b4db20) at kernel/qcoreapplication.cpp:1064
#49 0x00007f7f0f0a06db in QCoreApplicationPrivate::sendPostedEvents(QObject*, int, QThreadData*) (receiver=0x0, event_type=0, data=0x556743077580) at kernel/qcoreapplication.cpp:1821
#50 0x00007f7f0f0e6748 in postEventSourceDispatch(GSource*, GSourceFunc, gpointer) (s=0x5567431dc910) at kernel/qeventdispatcher_glib.cpp:277
#51 0x00007f7f0cd0fa31 in g_main_dispatch (context=0x7f7f04000ee0) at ../glib/glib/gmain.c:3460
#52 g_main_context_dispatch (context=0x7f7f04000ee0) at ../glib/glib/gmain.c:4200
#53 0x00007f7f0cd6ccc9 in g_main_context_iterate.isra.0 (context=context@entry=0x7f7f04000ee0, block=block@entry=1, dispatch=dispatch@entry=1, self=<optimized out>) at ../glib/glib/gmain.c:4276
#54 0x00007f7f0cd0d0e2 in g_main_context_iteration (context=0x7f7f04000ee0, may_block=1) at ../glib/glib/gmain.c:4343
#55 0x00007f7f0f0ea5cc in QEventDispatcherGlib::processEvents(QFlags<QEventLoop::ProcessEventsFlag>) (this=0x5567431e1a50, flags=...) at kernel/qeventdispatcher_glib.cpp:423
#56 0x00007f7f0f09a484 in QEventLoop::exec(QFlags<QEventLoop::ProcessEventsFlag>) (this=this@entry=0x7ffe36a69be0, flags=..., flags@entry=...) at ../../include/QtCore/../../src/corelib/global/qflags.h:69
#57 0x00007f7f0f09b923 in QCoreApplication::exec() () at ../../include/QtCore/../../src/corelib/global/qflags.h:121
#58 0x00007f7f0f53bf12 in QGuiApplication::exec() () at kernel/qguiapplication.cpp:1870
#59 0x00007f7f0fd76cda in QApplication::exec() () at kernel/qapplication.cpp:2832
#60 0x0000556742a8a60e in main(int, char**) (argc=<optimized out>, argv=<optimized out>) at /usr/src/debug/kate/kate-23.04.3/apps/kate/main.cpp:609
[Inferior 1 (process 65633) detached]

Reported using DrKonqi
Comment 1 Waqar Ahmed 2023-07-14 10:40:16 UTC
Hi, thanks for the report.

The crash is unrelated to editing / saving files. The crash happened because for some reason we had a stale widget pointer in the list, which was accessed and we crashed. By widgets, I mean things like "Welcome Page", "Diff viewer" or anything other than the editor that you can interact with.

- Do you recall interacting with any "widget" prior to the crash?
- Did you have multiple kate windows open?
- What plugins do you enable?
Comment 2 Aidan Coombs 2023-07-31 08:38:04 UTC
(In reply to Waqar Ahmed from comment #1)
> - Do you recall interacting with any "widget" prior to the crash?
Well, my 'Welcome' screen opens whenever Kate starts or no file is open. However, that is unlikely to be the culprit, as the Welcome screen closes whenever a file is open. It could be that my Ctrl+Tab made Kate attempt to switch to the closed Welcome screen due to some failure to properly regulate the Ctrl+Tab history when opening files.
> - Did you have multiple kate windows open?
No, I don't think so.
> - What plugins do you enable?
Document Switcher, Documents Tree, External Tools, File System Browser, Project Plugin, Search & Replace, Terminal, Text Filter, XML Validation.

I interact with the Terminal widget semi-regularly, cos it's pretty useful. I may have had it open at the time of the first crash, but definitely not the second. Potentially, I had opened it earlier in the first session (before the first crash) but since semi-closed it by clicking the 'Terminal' button in the bottom bar again, without exiting the shell by using the `exit` commanad. Perhaps this has something to do with that.

If plugins mean widgets, then obviously the Document Switcher is involved. The Documents Tree was not open at the time, I'm quite sure. I used the File System Browser to open the first file before each crash. I don't believe I interacted with any others.

I'm sorry, I have no idea why this crash occurred.
Comment 3 Danang Rahmatullah 2023-08-17 08:27:36 UTC
Created attachment 161017 [details]
New crash information added by DrKonqi

kate (23.04.3) using Qt 5.15.10

Pressing either ctrl+tab or ctrl+shift+tab crashes the app

-- Backtrace (Reduced):
#4  0x00007febaf5a80fd in QWidget::windowIcon() const () at /usr/lib/libQt5Widgets.so.5
[...]
#6  0x00007febaf80304e in QStyledItemDelegate::initStyleOption(QStyleOptionViewItem*, QModelIndex const&) const () at /usr/lib/libQt5Widgets.so.5
#7  0x00007febaf806fc3 in QStyledItemDelegate::sizeHint(QStyleOptionViewItem const&, QModelIndex const&) const () at /usr/lib/libQt5Widgets.so.5
#8  0x00007febaf8537f5 in QTreeView::indexRowSizeHint(QModelIndex const&) const () at /usr/lib/libQt5Widgets.so.5
#9  0x00007febaf8539c5 in QTreeViewPrivate::itemHeight(int) const () at /usr/lib/libQt5Widgets.so.5
Comment 4 Waqar Ahmed 2023-08-17 08:43:18 UTC
Do you have any steps to reproduce the crash? Do you use sessions?
Comment 5 Danang Rahmatullah 2023-08-17 08:57:16 UTC
(In reply to Waqar Ahmed from comment #4)
> Do you have any steps to reproduce the crash? Do you use sessions?

I did the following three times and the crash was reproducible.
1. Open a new instance of Kate.
2. Press Ctrl+N.
3. Press Ctrl+Shift+Tab

However, after closing all Kate windows and attempting to reproduce the crash, it is no longer reproducible at the current state of my machine. Unfortunately, I don't remember what files I had open in Kate before the crash took place.
Comment 6 Waqar Ahmed 2023-08-17 09:40:48 UTC
If you find a reproduce this, please let me know.
Comment 7 Danang Rahmatullah 2023-08-18 07:19:42 UTC
Created attachment 161043 [details]
Kate crash logs from journalctl

(In reply to Waqar Ahmed from comment #4)
> Do you have any steps to reproduce the crash? Do you use sessions?

I was able to reproduce it this morning.

After waking the laptop from sleep, I opened a new Kate instance from the Application Launcher. There were no Kate windows open prior to opening Kate from the Application launcher. Once the Kate window appeared, I noticed that there was a new document tab with the title "Untitled" rather than a no Welcome tab. Clicking Ctrl+Tab closed the Kate window and prompted a bug report notification. Due to issues with dunst, I was not able to submit a bug report from the crash report window, but I have attached the output of my `journalctl`.
Comment 8 Nick Shaforostoff 2023-10-14 15:54:42 UTC
I got this crash after updating from 22.12.3

#4  0x00007f94375d30bb in QIcon::QIcon(QIcon const&) () from /lib/x86_64-linux-gnu/libQt5Gui.so.5
#5  0x00007f9437f8d368 in QWidget::windowIcon() const () from /lib/x86_64-linux-gnu/libQt5Widgets.so.5
#6  0x00007f942450608d in ?? () from /usr/lib/x86_64-linux-gnu/qt5/plugins/ktexteditor/tabswitcherplugin.so
#7  0x00007f942450635c in ?? () from /usr/lib/x86_64-linux-gnu/qt5/plugins/ktexteditor/tabswitcherplugin.so
#8  0x00007f94381fc846 in QStyledItemDelegate::initStyleOption(QStyleOptionViewItem*, QModelIndex const&) const () from /lib/x86_64-linux-gnu/libQt5Widgets.so.5
#9  0x00007f94381fbf30 in QStyledItemDelegate::sizeHint(QStyleOptionViewItem const&, QModelIndex const&) const () from /lib/x86_64-linux-gnu/libQt5Widgets.so.5
#10 0x00007f94382411c3 in QTreeView::indexRowSizeHint(QModelIndex const&) const () from /lib/x86_64-linux-gnu/libQt5Widgets.so.5
#11 0x00007f9438244ae4 in QTreeViewPrivate::itemHeight(int) const () from /lib/x86_64-linux-gnu/libQt5Widgets.so.5
#12 0x00007f943824608d in QTreeViewPrivate::updateScrollBars() () from /lib/x86_64-linux-gnu/libQt5Widgets.so.5
#13 0x00007f943824feee in QTreeView::updateGeometries() () from /lib/x86_64-linux-gnu/libQt5Widgets.so.5
#14 0x00007f94381cf17c in QAbstractItemView::doItemsLayout() () from /lib/x86_64-linux-gnu/libQt5Widgets.so.5
#15 0x00007f943824e209 in QTreeView::doItemsLayout() () from /lib/x86_64-linux-gnu/libQt5Widgets.so.5
#16 0x00007f9438245b25 in QTreeView::sizeHintForColumn(int) const () from /lib/x86_64-linux-gnu/libQt5Widgets.so.5
#17 0x00007f9424507f58 in ?? () from /usr/lib/x86_64-linux-gnu/qt5/plugins/ktexteditor/tabswitcherplugin.so
#18 0x00007f9424503d4f in ?? () from /usr/lib/x86_64-linux-gnu/qt5/plugins/ktexteditor/tabswitcherplugin.so
#19 0x00007f9424503ee9 in ?? () from /usr/lib/x86_64-linux-gnu/qt5/plugins/ktexteditor/tabswitcherplugin.so
#20 0x00007f94245040c0 in ?? () from /usr/lib/x86_64-linux-gnu/qt5/plugins/ktexteditor/tabswitcherplugin.so
#21 0x00007f94370fba32 in ?? () from /lib/x86_64-linux-gnu/libQt5Core.so.5
#22 0x00007f9437f5c4d2 in QAction::triggered(bool) () from /lib/x86_64-linux-gnu/libQt5Widgets.so.5
Comment 9 Waqar Ahmed 2023-10-16 05:12:02 UTC
*** Bug 475614 has been marked as a duplicate of this bug. ***
Comment 10 Waqar Ahmed 2023-10-16 05:13:08 UTC
If you find a way to reproduce this that would be great.
Comment 11 Waqar Ahmed 2023-12-21 07:16:35 UTC
*** Bug 478810 has been marked as a duplicate of this bug. ***
Comment 12 Christoph Cullmann 2024-03-15 18:47:36 UTC
We altered a lot internal stuff for 24.02, please re-open if one can reproduce it with that version.
Comment 13 Bug Janitor Service 2024-03-30 03:46:56 UTC
Dear Bug Submitter,

This bug has been in NEEDSINFO status with no change for at least
15 days. Please provide the requested information as soon as
possible and set the bug status as REPORTED. Due to regular bug
tracker maintenance, if the bug is still in NEEDSINFO status with
no change in 30 days the bug will be closed as RESOLVED > WORKSFORME
due to lack of needed information.

For more information about our bug triaging procedures please read the
wiki located here:
https://community.kde.org/Guidelines_and_HOWTOs/Bug_triaging

If you have already provided the requested information, please
mark the bug as REPORTED so that the KDE team knows that the bug is
ready to be confirmed.

Thank you for helping us make KDE software even better for everyone!
Comment 14 Bug Janitor Service 2024-04-14 03:47:54 UTC
This bug has been in NEEDSINFO status with no change for at least
30 days. The bug is now closed as RESOLVED > WORKSFORME
due to lack of needed information.

For more information about our bug triaging procedures please read the
wiki located here:
https://community.kde.org/Guidelines_and_HOWTOs/Bug_triaging

Thank you for helping us make KDE software even better for everyone!