Bug 447740

Summary: Crash in QAccessible::queryAccessibleInterface
Product: [Frameworks and Libraries] frameworks-ktexteditor Reporter: Zamundaaa <xaver.hugl>
Component: generalAssignee: KWrite Developers <kwrite-bugs-null>
Status: RESOLVED WORKSFORME    
Severity: normal CC: a.samirh78, admin, christoph, debian, doc.evans, gmrandazzo, igorkuo, mail, mirovski36, piotr.mierzwinski, pruefer, robert, thijs.withaar, waqar.17a
Priority: VHI    
Version First Reported In: unspecified   
Target Milestone: ---   
Platform: Compiled Sources   
OS: Linux   
Latest Commit: Version Fixed In:
Sentry Crash Report:

Description Zamundaaa 2021-12-31 13:33:41 UTC
Happens quite a lot in KDevelop, on Wayland. Not sure if this is a bug in Qt or KDevelop, or KTextEditor...

(gdb) bt full
#0  0x00007f4bdbb735f4 in QAccessible::queryAccessibleInterface(QObject*) () at /usr/lib/libQt5Gui.so.5
#1  0x00007f4bdbb73e84 in QAccessibleEvent::accessibleInterface() const () at /usr/lib/libQt5Gui.so.5
#2  0x00007f4bdbb743d1 in QAccessible::updateAccessibility(QAccessibleEvent*) () at /usr/lib/libQt5Gui.so.5
#3  0x00007f4bde872db7 in KateViewInternal::cursorMoved() (this=0x563c189c63c0) at /home/xaver/kde/src/ktexteditor/src/view/kateviewinternal.cpp:4114
        ev = <incomplete type>
#4  0x00007f4bde86abec in KateViewInternal::updateCursor(KTextEditor::Cursor, bool, bool, bool) (this=0x563c189c63c0, newCursor=..., force=false, center=true, calledExternally=true) at /home/xaver/kde/src/ktexteditor/src/view/kateviewinternal.cpp:2364
        oldDisplayCursor = {m_line = 0, m_column = 0}
#5  0x00007f4bde84c0b0 in KTextEditor::ViewPrivate::setCursorPositionInternal(KTextEditor::Cursor, unsigned int, bool) (this=0x563c19a96cf0, position=..., tabwidth=1, calledExternally=true) at /home/xaver/kde/src/ktexteditor/src/view/kateview.cpp:1600
        l = {value = 0x563c1c712160, d = 0x563c1c712150}
        line_str = {d = 0x563c19a8d510}
        x = 1
        z = 1
#6  0x00007f4bde850c38 in KTextEditor::ViewPrivate::setCursorPosition(KTextEditor::Cursor) (this=0x563c19a96cf0, position=...) at /home/xaver/kde/src/ktexteditor/src/view/kateview.cpp:2691
#7  0x00007f4bde762178 in KTextEditor::DocumentPrivate::documentReload() (this=0x563c198d9a60) at /home/xaver/kde/src/ktexteditor/src/document/katedocument.cpp:4473
        it = 0x7ffc0d1f8190
        v = 0x563c19a96cf0
        __for_range = @0x563c198d9ae8: {{d = 0x563c19aebe20, e = 0x563c19aebe20}}
        __for_begin = {i = 0x563c19aecf10}
        __for_end = {i = 0x563c19aebe20}
        tmp = 
            {a = 256, s = 0, ptr = 0x7ffc0d1f81e0, {array = "&\000\000\000\000\000\000\000@\000\334!<V\000\000`\273\270\027<V\000\000\320\033\225\027<V\000\000\220\006\334!<V\000\000(\201\335\331K\177\000\000P\027q\034<V\000\000\060F\341\027<V\000\000\020~\326\027<V\000\000\300\203\037\r\374\177\000\000`@\274\027<V\000\000\002\000\000\000K\177\000\000\320\033\225\027<V\000\000\021\030\030\000\002", '\000' <repeats 12 times>, "Z\224OO\350\035\000\000\000\000<V\000\000\016\000\000\000\000\000\000\000`\202\037\r\374\177\000\000\000\000\000\000\000\001\000\000\000\000\000\200\000\000\000\000\240\320\331\331K\177\000\000\000\000\000\000\000\000\000\000,f\341\027<V\000\000\001\000\000\000&\000\000\000\003"..., q_for_alignment_1 = 38, q_for_alignment_2 = 1.8774494541967369e-322}}
        oldMode = {d = 0x563c19a8e770}
        modeByUser = false
        oldHlMode = {d = 0x563c17d03010}
        hlByUser = false
        cursorPositions = {a = 4, s = 1, ptr = 0x7ffc0d1f8190, {array = "\360l\251\031<V\000\000\350\001\000\000N\000\000\000\320\033\225\027<V\000\000\374\065\330\331K\177\000\000PF\274\027<V\000\000\024", '\000' <repeats 16 times>, "Z\224OO\350\035", q_for_alignment_1 = 94816128560368, q_for_alignment_2 = 4.6845391793344878e-310}}
        z = 20
        lines = 0
#8  0x00007f4be0090d62 in KDevelop::TextDocument::reload() (this=0x563c19aa0690) at /home/xaver/kde/src/kdevelop/kdevplatform/shell/textdocument.cpp:407
        d = 0x563c19a9e6b0
        modif = 0x0
#9  0x00007f4be0092b30 in KDevelop::TextDocument::repositoryCheckFinished(bool) (this=0x563c19aa0690, canRecreate=true) at /home/xaver/kde/src/kdevelop/kdevplatform/shell/textdocument.cpp:796
        d = 0x563c19a9e6b0
        modIface = 0x563c198d9a98
#10 0x00007f4be009756b in QtPrivate::FunctorCall<QtPrivate::IndexesList<0>, QtPrivate::List<bool>, void, void (KDevelop::TextDocument::*)(bool)>::call(void (KDevelop::TextDocument::*)(bool), KDevelop::TextDocument*, void**) (f=(void (KDevelop::TextDocument::*)(KDevelop::TextDocument * const, bool)) 0x7f4be00929c4 <KDevelop::TextDocument::repositoryCheckFinished(bool)>, o=0x563c19aa0690, arg=0x7ffc0d1f9450) at /usr/include/qt/QtCore/qobjectdefs_impl.h:152
#11 0x00007f4be00970ff in QtPrivate::FunctionPointer<void (KDevelop::TextDocument::*)(bool)>::call<QtPrivate::List<bool>, void>(void (KDevelop::TextDocument::*)(bool), KDevelop::TextDocument*, void**) (f=(void (KDevelop::TextDocument::*)(KDevelop::TextDocument * const, bool)) 0x7f4be00929c4 <KDevelop::TextDocument::repositoryCheckFinished(bool)>, o=0x563c19aa0690, arg=0x7ffc0d1f9450) at /usr/include/qt/QtCore/qobjectdefs_impl.h:185
#12 0x00007f4be00968f7 in QtPrivate::QSlotObject<void (KDevelop::TextDocument::*)(bool), QtPrivate::List<bool>, void>::impl(int, QtPrivate::QSlotObjectBase*, QObject*, void**, bool*) (which=1, this_=0x563c21aa80d0, r=0x563c19aa0690, a=0x7ffc0d1f9450, ret=0x0) at /usr/include/qt/QtCore/qobjectdefs_impl.h:418
#13 0x00007f4bdb49b915 in  () at /usr/lib/libQt5Core.so.5
#14 0x00007f4bdaac29bb in KDevelop::CheckInRepositoryJob::finished(bool) (this=0x563c22a448c0, _t1=true) at /home/xaver/kde/build/kdevelop/kdevplatform/vcs/KDevPlatformVcs_autogen/5Z5WMX6UGY/moc_icontentawareversioncontrol.cpp:141
        _a = {0x0, 0x7ffc0d1f9444}
#15 0x00007f4b490731b4 in GitPluginCheckInRepositoryJob::repositoryQueryFinished(int) (this=0x563c22a448c0) at /home/xaver/kde/src/kdevelop/plugins/git/gitplugincheckinrepositoryjob.cpp:77
        output = {d = 0x563c21f60c90}
        requestSucceeded = true
#16 0x00007f4b49073e86 in QtPrivate::FunctorCall<QtPrivate::IndexesList<0>, QtPrivate::List<int>, void, void (GitPluginCheckInRepositoryJob::*)(int)>::call(void (GitPluginCheckInRepositoryJob::*)(int), GitPluginCheckInRepositoryJob*, void**) (f=(void (GitPluginCheckInRepositoryJob::*)(GitPluginCheckInRepositoryJob * const, int)) 0x7f4b49073154 <GitPluginCheckInRepositoryJob::repositoryQueryFinished(int)>, o=0x563c22a448c0, arg=0x7ffc0d1f9660) at /usr/include/qt/QtCore/qobjectdefs_impl.h:152
#17 0x00007f4b49073bc7 in QtPrivate::FunctionPointer<void (GitPluginCheckInRepositoryJob::*)(int)>::call<QtPrivate::List<int>, void>(void (GitPluginCheckInRepositoryJob::*)(int), GitPluginCheckInRepositoryJob*, void**) (f=(void (GitPluginCheckInRepositoryJob::*)(GitPluginCheckInRepositoryJob * const, int)) 0x7f4b49073154 <GitPluginCheckInRepositoryJob::repositoryQueryFinished(int)>, o=0x563c22a448c0, arg=0x7ffc0d1f9660) at /usr/include/qt/QtCore/qobjectdefs_impl.h:185
#18 0x00007f4b490737c7 in QtPrivate::QSlotObject<void (GitPluginCheckInRepositoryJob::*)(int), QtPrivate::List<int>, void>::impl(int, QtPrivate::QSlotObjectBase*, QObject*, void**, bool*) (which=1, this_=0x563c22b38690, r=0x563c22a448c0, a=0x7ffc0d1f9660, ret=0x0) at /usr/include/qt/QtCore/qobjectdefs_impl.h:418
#19 0x00007f4bdb49b915 in  () at /usr/lib/libQt5Core.so.5
#20 0x00007f4bdb3cac5d in QProcess::finished(int, QProcess::ExitStatus) () at /usr/lib/libQt5Core.so.5
#21 0x00007f4bdb3d0816 in  () at /usr/lib/libQt5Core.so.5
#22 0x00007f4bdb3d094e in  () at /usr/lib/libQt5Core.so.5
#23 0x00007f4bdb49b96b in  () at /usr/lib/libQt5Core.so.5
#24 0x00007f4bdb49ef24 in QSocketNotifier::activated(QSocketDescriptor, QSocketNotifier::Type, QSocketNotifier::QPrivateSignal) () at /usr/lib/libQt5Core.so.5
#25 0x00007f4bdb49f765 in QSocketNotifier::event(QEvent*) () at /usr/lib/libQt5Core.so.5
#26 0x00007f4bdc427ff6 in QApplicationPrivate::notify_helper(QObject*, QEvent*) () at /usr/lib/libQt5Widgets.so.5
#27 0x00007f4bdb46420a in QCoreApplication::notifyInternal2(QObject*, QEvent*) () at /usr/lib/libQt5Core.so.5
#28 0x00007f4bdb4be786 in  () at /usr/lib/libQt5Core.so.5
#29 0x00007f4bd90f24dc in g_main_context_dispatch () at /usr/lib/libglib-2.0.so.0
#30 0x00007f4bd9146799 in  () at /usr/lib/libglib-2.0.so.0
#31 0x00007f4bd90efbc1 in g_main_context_iteration () at /usr/lib/libglib-2.0.so.0
#32 0x00007f4bdb4bdb2a in QEventDispatcherGlib::processEvents(QFlags<QEventLoop::ProcessEventsFlag>) () at /usr/lib/libQt5Core.so.5
#33 0x00007f4bdb462abb in QEventLoop::exec(QFlags<QEventLoop::ProcessEventsFlag>) () at /usr/lib/libQt5Core.so.5
#34 0x00007f4bdb46b2a8 in QCoreApplication::exec() () at /usr/lib/libQt5Core.so.5
#35 0x0000563c15d37c33 in main(int, char**) (argc=1, argv=0x7ffc0d1f9f88) at /home/xaver/kde/src/kdevelop/app/main.cpp:846
        timer = {t1 = -9223372036854775808, t2 = -9223372036854775808}
        debugArgs = {<QList<QString>> = {<QListSpecialMethods<QString>> = {<No data fields>}, {p = {static shared_null = {ref = {atomic = {_q_value = {<std::__atomic_base<int>> = {static _S_alignment = 4, _M_i = -1}, static is_always_lock_free = true}}}, alloc = 0, begin = 0, end = 0, array = {0x0}}, d = 0x7f4bdb552cb0 <QListData::shared_null>}, d = 0x7f4bdb552cb0 <QListData::shared_null>}}, <No data fields>}
        debugeeName = {d = 0x7f4bdb5521a0 <QArrayData::shared_null>}
        app = {<QApplication> = {<No data fields>}, static staticMetaObject = {d = {superdata = {direct = 0x7f4bdc9608e0 <QApplication::staticMetaObject>}, stringdata = 0x563c15d445a0 <qt_meta_stringdata_KDevelopApplication>, data = 0x563c15d44660 <qt_meta_data_KDevelopApplication>, static_metacall = 0x563c15d37d26 <KDevelopApplication::qt_static_metacall(QObject*, QMetaObject::Call, int, void**)>, relatedMetaObjects = 0x0, extradata = 0x0}}}
        aboutData = {d = std::unique_ptr<KAboutDataPrivate> = {get() = {<No data fields>}}}
        migrator = {d = std::unique_ptr<Kdelibs4ConfigMigratorPrivate> = {get() = {<No data fields>}}}
        __PRETTY_FUNCTION__ = "int main(int, char**)"
        parser = {d = 0x563c177bf850}
        initialFiles = {d = 0x7f4bdb5521a0 <QArrayData::shared_null>}
        initialDirectories = {d = 0x7f4bdb5521a0 <QArrayData::shared_null>}
        files = {<QList<QString>> = {<QListSpecialMethods<QString>> = {<No data fields>}, {p = {static shared_null = {ref = {atomic = {_q_value = {<std::__atomic_base<int>> = {static _S_alignment = 4, _M_i = -1}, static is_always_lock_free = true}}}, alloc = 0, begin = 0, end = 0, array = {0x0}}, d = 0x7f4bdb552cb0 <QListData::shared_null>}, d = 0x7f4bdb552cb0 <QListData::shared_null>}}, <No data fields>}
        availableSessionInfos = {d = 0x563c17a1b910}
        session = {d = 0x7f4bdb5521a0 <QArrayData::shared_null>}
        nRunningSessions = 0
        core = 0x563c179e25d0
        fetchUrlStrings = {<QList<QString>> = {<QListSpecialMethods<QString>> = {<No data fields>}, {p = {static shared_null = {ref = {atomic = {_q_value = {<std::__atomic_base<int>> = {static _S_alignment = 4, _M_i = -1}, static is_always_lock_free = true}}}, alloc = 0, begin = 0, end = 0, array = {0x0}}, d = 0x7f4bdb552cb0 <QListData::shared_null>}, d = 0x7f4bdb552cb0 <QListData::shared_null>}}, <No data fields>}
        debugStr = {d = 0x563c15d431c0 <main::{lambda()#122}::operator()() const::qstring_literal>}
Comment 1 Waqar Ahmed 2022-05-18 15:09:31 UTC
*** Bug 451041 has been marked as a duplicate of this bug. ***
Comment 2 Sven Brauch 2022-05-18 15:51:12 UTC
Hm, since you're not seeing it, it is of course possible it's specific to KDevelop. But in this trace, the KDevelop stacktrace looks innocent enough to me... the git plugin detected changes in this document, so it is being reloaded, and from the reload on everything is in KTextEditor only.

Maybe some special condition is needed to trigger this, I could e.g. imagine something like "a document is being reloaded for which the view has never been visible before"?

Unfortunately I have absolute zero knowledge about QAccessible :/
Comment 3 Waqar Ahmed 2022-05-18 16:08:48 UTC
Has it ever crashed in X? 

Maybe this is something specific to wayland, and it could be that kate users are just lucky till now
Comment 4 Sven Brauch 2022-05-18 16:11:51 UTC
The other bug https://bugs.kde.org/show_bug.cgi?id=451041 says X11...
Comment 5 Zamundaaa 2022-05-18 17:36:40 UTC
I've seen it crashing with a similar backtrace on X11 myself as well.
Comment 6 Waqar Ahmed 2022-05-19 05:44:08 UTC
Did some digging, but didn't get anywhere. Maybe the accessibleInterface pointer inside updateAccessibility() is invalid which leads to a crash. When we reload the doc, the views, if any are valid before and after regardless of whether they became visible or not.

A quick workaround fix would be to allow the user to disable/enable accessibility. This would avoid the crash.
Comment 7 Ahmad Samir 2022-05-24 09:48:25 UTC
I noticed this in the backtrace:
#3  0x00007f4bde872db7 in KateViewInternal::cursorMoved() (this=0x563c189c63c0) at /home/xaver/kde/src/ktexteditor/src/view/kateviewinternal.cpp:4114
        ev = <incomplete type>

"incomplete type" is a bit weird; looking at ktexteditor:
void KateViewInternal::cursorMoved()
{
    view()->updateRangesIn(KTextEditor::Attribute::ActivateCaretIn);

#ifndef QT_NO_ACCESSIBILITY
    if (QAccessible::isActive()) {
        QAccessibleTextCursorEvent ev(this, static_cast<KateViewAccessible *>(QAccessible::queryAccessibleInterface(this))->positionFromCursor(this, m_cursor));
        QAccessible::updateAccessibility(&ev);
    }
#endif
}

QAccessible::queryAccessibleInterface() returns a QAccessibleInterface*, so we'd have to use QAccessibleInterface::textInterface() to get a QAccessibleTextInterface*; not sure if this makes a difference but I'd try:
@@ -4597,7 +4597,8 @@ void KateViewInternal::cursorMoved()
 
 #ifndef QT_NO_ACCESSIBILITY
     if (QAccessible::isActive()) {
-        QAccessibleTextCursorEvent ev(this, static_cast<KateViewAccessible *>(QAccessible::queryAccessibleInterface(this))->positionFromCursor(this, m_cursor));
+        KateViewAccessible *iface = static_cast<KateViewAccessible *>(QAccessible::queryAccessibleInterface(this)->textInterface());
+        QAccessibleTextCursorEvent ev(this, iface->positionFromCursor(this, m_cursor));
         QAccessible::updateAccessibility(&ev);
     }
 #endif

(If it works, feel free to use it in a MR).
Comment 8 Christoph Cullmann 2022-05-24 16:46:28 UTC
I can't reproduce this myself.
I fail to see how the change can work, given in all other locations we don't use the ->textInterface() call either, or are they all wrong?
Comment 9 Ahmad Samir 2022-05-27 16:15:38 UTC
I was wrong, somehow the compiler casts it to the appropriate type; I was confused by the <incomplete type> in the backtrace, but that could be gdb confused too by too many layers of inheritance/casts.
Comment 10 Martin Ottmar 2022-10-04 10:38:29 UTC
Still keeps crashing "randomly".  Few minutes ago just after pressing Alt+TAB to get into KDevelop followed by pressing key "Key_Down" (immediatelly) in order to see lower lines in the current editor tab with some python code. It is possible that the Ctrl key has been pressed too at the same time (HP laptop with some bios troubles in linux - it generates Ctrl key press randomly, especially under heavy load - not spotted in MS Windows when analysed by our technicians).
It has been the first crash in QAccessibleEvent related to a key press. Usually, it crashes just after LMB on an editor tab or inside the editor window, but I think, always just after applications switch.

Updated Archlinux (5.98.0, 22.08.1),  KDevelop with VI mode and with the kdev-python plugin from AUR. Normal X-server configuration with plasma, no any wayland.

Application: KDevelop (kdevelop), signal: Segmentation fault

[KCrash Handler]
#4  0x00007f169e715f90 in QAccessibleObject::object() const () at /usr/lib/libQt5Gui.so.5
#5  0x00007f169f1c00de in QAccessibleWidget::isValid() const () at /usr/lib/libQt5Widgets.so.5
#6  0x00007f169e71f0fd in QAccessibleEvent::accessibleInterface() const () at /usr/lib/libQt5Gui.so.5
#7  0x00007f169e71acb5 in QAccessible::updateAccessibility(QAccessibleEvent*) () at /usr/lib/libQt5Gui.so.5
#8  0x00007f169bde0614 in KateViewInternal::cursorMoved() () at /usr/lib/libKF5TextEditor.so.5
#9  0x00007f169bdd6bff in KateViewInternal::updateCursor(KTextEditor::Cursor, bool, bool, bool) () at /usr/lib/libKF5TextEditor.so.5
#10 0x00007f169be50cdd in KateVi::NormalViMode::handleKeypress(QKeyEvent const*) () at /usr/lib/libKF5TextEditor.so.5
#11 0x00007f169be6169c in KateVi::InputModeManager::handleKeypress(QKeyEvent const*) () at /usr/lib/libKF5TextEditor.so.5
#12 0x00007f169be3e88a in KateViInputMode::keyPress(QKeyEvent*) () at /usr/lib/libKF5TextEditor.so.5
#13 0x00007f169be3b8f7 in KateViInputMode::stealKey(QKeyEvent*) () at /usr/lib/libKF5TextEditor.so.5
#14 0x00007f169bde2875 in KateViewInternal::eventFilter(QObject*, QEvent*) () at /usr/lib/libKF5TextEditor.so.5
#15 0x00007f169e28c7f2 in QCoreApplicationPrivate::sendThroughObjectEventFilters(QObject*, QEvent*) () at /usr/lib/libQt5Core.so.5
#16 0x00007f169ef78b0c in QApplicationPrivate::notify_helper(QObject*, QEvent*) () at /usr/lib/libQt5Widgets.so.5
#17 0x00007f169ef7ddf8 in QApplication::notify(QObject*, QEvent*) () at /usr/lib/libQt5Widgets.so.5
#18 0x00007f169e28cb88 in QCoreApplication::notifyInternal2(QObject*, QEvent*) () at /usr/lib/libQt5Core.so.5
#19 0x00007f169efcf18b in  () at /usr/lib/libQt5Widgets.so.5
#20 0x00007f169ef78b1c in QApplicationPrivate::notify_helper(QObject*, QEvent*) () at /usr/lib/libQt5Widgets.so.5
#21 0x00007f169e28cb88 in QCoreApplication::notifyInternal2(QObject*, QEvent*) () at /usr/lib/libQt5Core.so.5
#22 0x00007f169e73fb50 in QGuiApplicationPrivate::processKeyEvent(QWindowSystemInterfacePrivate::KeyEvent*) () at /usr/lib/libQt5Gui.so.5
#23 0x00007f169e720dfe in bool QWindowSystemInterfacePrivate::handleWindowSystemEvent<QWindowSystemInterface::SynchronousDelivery>(QWindowSystemInterfacePrivate::WindowSystemEvent*) () at /usr/lib/libQt5Gui.so.5
#24 0x00007f169e72a0e6 in QWindowSystemInterface::handleShortcutEvent(QWindow*, unsigned long, int, QFlags<Qt::KeyboardModifier>, unsigned int, unsigned int, unsigned int, QString const&, bool, unsigned short) () at /usr/lib/libQt5Gui.so.5
#25 0x00007f169e73faf2 in QGuiApplicationPrivate::processKeyEvent(QWindowSystemInterfacePrivate::KeyEvent*) () at /usr/lib/libQt5Gui.so.5
#26 0x00007f169e728985 in QWindowSystemInterface::sendWindowSystemEvents(QFlags<QEventLoop::ProcessEventsFlag>) () at /usr/lib/libQt5Gui.so.5
#27 0x00007f167ff2f6c0 in  () at /usr/lib/libQt5XcbQpa.so.5
#28 0x00007f169a1e281b in g_main_context_dispatch () at /usr/lib/libglib-2.0.so.0
#29 0x00007f169a238ec9 in  () at /usr/lib/libglib-2.0.so.0
#30 0x00007f169a1e10d2 in g_main_context_iteration () at /usr/lib/libglib-2.0.so.0
#31 0x00007f169e2d750c in QEventDispatcherGlib::processEvents(QFlags<QEventLoop::ProcessEventsFlag>) () at /usr/lib/libQt5Core.so.5
#32 0x00007f169e28532c in QEventLoop::exec(QFlags<QEventLoop::ProcessEventsFlag>) () at /usr/lib/libQt5Core.so.5
#33 0x00007f169e28fe59 in QCoreApplication::exec() () at /usr/lib/libQt5Core.so.5
#34 0x0000558bfb28cba9 in  ()
#35 0x00007f169da3c290 in  () at /usr/lib/libc.so.6
#36 0x00007f169da3c34a in __libc_start_main () at /usr/lib/libc.so.6
#37 0x0000558bfb28d715 in  ()
[Inferior 1 (process 3769) detached]
Comment 11 Igor Kushnir 2022-12-01 06:53:31 UTC
*** Bug 462455 has been marked as a duplicate of this bug. ***
Comment 12 Igor Kushnir 2022-12-01 06:54:54 UTC
*** Bug 446487 has been marked as a duplicate of this bug. ***
Comment 13 Igor Kushnir 2022-12-01 06:55:59 UTC
*** Bug 448885 has been marked as a duplicate of this bug. ***
Comment 14 Igor Kushnir 2022-12-01 06:56:38 UTC
*** Bug 449294 has been marked as a duplicate of this bug. ***
Comment 15 Igor Kushnir 2022-12-01 06:57:23 UTC
*** Bug 453684 has been marked as a duplicate of this bug. ***
Comment 16 Igor Kushnir 2022-12-01 06:59:05 UTC
*** Bug 453773 has been marked as a duplicate of this bug. ***
Comment 17 Igor Kushnir 2023-08-10 08:45:42 UTC
*** Bug 472891 has been marked as a duplicate of this bug. ***
Comment 18 Waqar Ahmed 2023-08-10 10:29:13 UTC
Since we haven't gotten even a single bugreport from Kate users I am inclined to believe that this might be a bug in KDevelop
Comment 19 Igor Kushnir 2023-08-10 18:50:13 UTC
*** Bug 473250 has been marked as a duplicate of this bug. ***
Comment 20 doc.evans 2023-08-28 22:21:04 UTC
Just to confirm that this isn't associated with Wayland. I reported bug https://bugs.kde.org/show_bug.cgi?id=473251 which is perhaps the same bug (although I'm not absolutely certain about that) and I don't use Wayland at all. In fact here it's always X-over-ssh.

In case it helps, here is part of my most recent post on bug 473251:

----

 2. The crashes occur at the rate of about two per hour... I can get work done, 
but it's certainly annoying to be interrupted by crashes so frequently.

3. I have not found a particular sequence of actions that is guaranteed to 
reproduce the crash.

4. I *think* that crashes happen only when I've actively interacted with the 
editor window: either I'm in the middle of typing, or at the very least, I've 
just clicked somewhere in the window.

5. FYI, the project I'm working on is: https://github.com/N7DR/drlog.

----

Since installing debian bookworm on the computer in question, I have never seen any crash except when using kdevelop (i.e., not when using Kate or any other KDE program).
Comment 21 doc.evans 2023-09-18 20:19:11 UTC
When I reported this bug (as https://bugs.kde.org/show_bug.cgi?id=472891) I was using the nouveau driver on the X server. Using that driver, the crashes were frequent.

Last week I switched to the modesetting driver (details in this thread: https://lists.debian.org/debian-user/2023/09/msg00218.html) on the machine on which the X server resides. Since then, this crash has not occurred, despite considerable use of kdevelop.

No other relevant changes that I know of were made.
Comment 22 doc.evans 2023-09-26 15:55:14 UTC
(In reply to doc.evans from comment #21)
> When I reported this bug (as https://bugs.kde.org/show_bug.cgi?id=472891) I
> was using the nouveau driver on the X server. Using that driver, the crashes
> were frequent.
> 
> Last week I switched to the modesetting driver (details in this thread:
> https://lists.debian.org/debian-user/2023/09/msg00218.html) on the machine
> on which the X server resides. Since then, this crash has not occurred,
> despite considerable use of kdevelop.
> 
> No other relevant changes that I know of were made.

I spoke too soon. I am still seeing crashes. I get the distinct impression that they are less frequent, but perhaps that's just wishful thinking. It was certainly true for a while after changing drivers, but I could believe that that was just random happenstance.
Comment 23 Igor Kushnir 2023-10-18 08:57:12 UTC
*** Bug 475766 has been marked as a duplicate of this bug. ***
Comment 24 Bug Janitor Service 2023-10-19 08:10:43 UTC
A possibly relevant merge request was started @ https://invent.kde.org/frameworks/ktexteditor/-/merge_requests/617
Comment 25 Waqar Ahmed 2023-10-19 17:41:50 UTC
Git commit a64125ae585c96ee16081fc75d525624311001cc by Waqar Ahmed.
Committed on 19/10/2023 at 18:31.
Pushed by cullmann into branch 'master'.

Allow enabling/disabling accessibility

On Manjaro KDE (and possibly others) it seems that accessibility is
always enabled for some reason. Lately it has been causing a lot of
crashes in KDevelop and in general it is really bad for performance
especially if you are doing something that results in a large number of
edits at once

M  +17   -0    src/dialogs/editconfigwidget.ui
M  +3    -0    src/dialogs/katedialogs.cpp
M  +1    -0    src/utils/kateconfig.cpp
M  +1    -0    src/utils/kateconfig.h
M  +2    -0    src/view/kateview.cpp
M  +1    -0    src/view/kateview.h
M  +3    -3    src/view/kateviewinternal.cpp

https://invent.kde.org/frameworks/ktexteditor/-/commit/a64125ae585c96ee16081fc75d525624311001cc
Comment 26 doc.evans 2023-10-19 19:20:00 UTC
(In reply to Waqar Ahmed from comment #25)

> 
> Allow enabling/disabling accessibility
> 
> On Manjaro KDE (and possibly others) it seems that accessibility is
> always enabled for some reason. Lately it has been causing a lot of
> crashes in KDevelop and in general it is really bad for performance

So I am quite puzzled by the above. I obviously have KDE installed, otherwise I could not be using kdevelop. But I'm not actually running KDE as a desktop environment on either of the machines here that exhibit the problem. So is there some KDE-related config file somewhere that I should edit in order to be sure that accessibility support is turned off when I run kdevelop?

(FWIW, on one machine I simply ssh into the machine and run kdevelop over the network, so there is no desktop environment at all; on the other machine I am using Trinity as the desktop environment.)
Comment 27 Igor Kushnir 2023-10-22 10:53:03 UTC
*** Bug 475924 has been marked as a duplicate of this bug. ***
Comment 28 Igor Kushnir 2023-10-22 11:00:43 UTC
(In reply to doc.evans from comment #26)
> So I am quite puzzled by the above. I obviously have KDE installed,
> otherwise I could not be using kdevelop. But I'm not actually running KDE as
> a desktop environment on either of the machines here that exhibit the
> problem. So is there some KDE-related config file somewhere that I should
> edit in order to be sure that accessibility support is turned off when I run
> kdevelop?
The commit adds at option to turn accessibility off into the Editor=>Editing=>General page of the Configure KDevelop dialog. However the commit wasn't cherry picked into the kf5 branch. So it will become available in KDevelop only once it is ported to KF6. If someone can confirm that patching a KF5 version of KTextEditor with the commit and turning accessibility off eliminates this crash, then maybe we could cherry-pick it into the kf5 branch of KTextEditor.
Comment 29 Christoph Cullmann 2024-01-20 21:27:13 UTC
One can turn it off in master and for any more changes we would need a way to reproduce this.
Comment 30 doc.evans 2024-01-20 23:34:03 UTC
(In reply to Igor Kushnir from comment #28)
> (In reply to doc.evans from comment #26)
> > So I am quite puzzled by the above. I obviously have KDE installed,
> > otherwise I could not be using kdevelop. But I'm not actually running KDE as
> > a desktop environment on either of the machines here that exhibit the
> > problem. So is there some KDE-related config file somewhere that I should
> > edit in order to be sure that accessibility support is turned off when I run
> > kdevelop?
> The commit adds at option to turn accessibility off into the
> Editor=>Editing=>General page of the Configure KDevelop dialog. However the
> commit wasn't cherry picked into the kf5 branch. So it will become available
> in KDevelop only once it is ported to KF6. If someone can confirm that
> patching a KF5 version of KTextEditor with the commit and turning
> accessibility off eliminates this crash, then maybe we could cherry-pick it
> into the kf5 branch of KTextEditor.

I have no way to test anything... just an ordinary user... but I got hit with this five times in less than an hour a couple of days ago when I was trying to tidy up some code, so am seriously thinking of going back to codelite (which certainly has problems of its own, which is why I left it in favour of kdevelop, but at least it doesn't crash), just because this bug is so frustrating and keeps getting in the way of the task at hand -- it feels like driving a car that stalls every few miles :-( -- yes, you can get the job done, but you waste an awful lot of time trying to get the car restarted (or recovering from the kdevelop crash).
Comment 31 Christoph Cullmann 2024-01-21 17:27:00 UTC
Hi, just to be sure: That happens for Kate, too?
Comment 32 doc.evans 2024-01-21 20:14:21 UTC
(In reply to Christoph Cullmann from comment #31)
> Hi, just to be sure: That happens for Kate, too?

If that question is intended for me, the answer is that, per comment #20, the only program in which I've experienced a crash is kdevelop.
Comment 33 Christoph Cullmann 2024-01-21 21:41:57 UTC
(In reply to doc.evans from comment #32)
> (In reply to Christoph Cullmann from comment #31)
> > Hi, just to be sure: That happens for Kate, too?
> 
> If that question is intended for me, the answer is that, per comment #20,
> the only program in which I've experienced a crash is kdevelop.

Yes, thanks. If that only is triggered there, I am not sure that is really a KTextEditor issue.
Comment 34 doc.evans 2024-01-22 08:53:53 UTC
(In reply to Christoph Cullmann from comment #33)

> Yes, thanks. If that only is triggered there, I am not sure that is really a
> KTextEditor issue.

I have no idea where the issue lies. Since I'm just an ordinary person trying to get some work done on my debian stable systems, all I can do really is report the bug and send stack traces, which is what I've done. My original report is https://bugs.kde.org/show_bug.cgi?id=473251.

I think that I'll just go back to using codeview; I'm spending too long waiting waiting for kdevelop to recover after each crash; it's just too frustrating to try to use something that's so unstable :-( The main project that I'm working on,  https://github.com/N7DR/drlog, is big enough that even just starting kdevelop with that project takes more than a minute on my development machine. Waiting all that time after each kdevelop crash really is getting to be just too frustrating :-(
Comment 35 Claus Prüfer 2025-04-22 16:44:00 UTC
Since my KDE Bug reporting tool still hangs on final bug-submission (no way of getting entered text back), i have to repeat the bug-reporting without a back-trace attached. Also i can not find where the core-dump has been saved locally.

The application (KDevelop) crashed with a Segmentation Fault (core-dumped), this is an indicator that some sort of null-pointer, double-free or similar has happened (in kernel).

Since the bug occurred repeatedly on my systems multiple times, regardless of Linux-System, Windows Manager (X11 and Wayland), Graphics Driver (Intel, Nuveau or compiled NVIDIA drivers), i assume the cause is to find somewhere in "Mouse / Keyboard" interface handling of involved interfaces (Kernel / QT / KDE Base / Kate), maybe in combination with source-code highlighting update / triggering (indicator in first comment / back-trace: "KDevelop::TextDocument::reload()" or "QAccessibleEvent::accessibleInterface()").

Also the crash happened multiple times after my mouse-cursor got laggy in Firefox-browser (maybe interrupt handling / network interface card / malware). The case the same crash occurred on internet-less setup multiple times excludes the malware suspect (but do not underestimate malware creators).

All back-traces include "QAccessibleEvent::accessibleInterface()" and "QAccessible::updateAccessibility(QAccessibleEvent*) () and KateViewInternal::cursorMoved()".

Additionally i can report that i clicked the mouse accidentally multiple times quite fast, this could be an indicator that somewhere a queue processing (threaded?) contains too much or too less pointers or pointers to already deleted memory (maybe time dependent too).

As already mentioned, the occurrence is Linux independent, but to complete information:

Operating System: Devuan GNU/Linux 5
KDE Plasma Version: 5.27.5
KDE Frameworks Version: 5.103.0
Qt Version: 5.15.8
Kernel Version: 6.1.0-33-amd64 (64-bit)
Graphics Platform: X11
Processors: 4 × Intel® Core™ i5-2520M CPU @ 2.50GHz
Memory: 7.5 GiB of RAM
Graphics Processor: Mesa Intel® HD Graphics 3000
Manufacturer: LENOVO
Product Name: 4236N3G
System Version: ThinkPad T420

Hopefully i could help finding the bug.
Comment 36 Igor Kushnir 2025-04-22 17:34:34 UTC
(In reply to Claus Prüfer from comment #35)
> KDE Frameworks Version: 5.103.0
> Qt Version: 5.15.8
KTextEditor 5.x and KDevelop 5.x are no longer supported and no new 5.x releases are planned.

If this crash occurs in KDevelop 6.x, a workaround is to disable the "Enable accessibility notifications" option on the Editor->Editing tab of the Configure KDevelop dialog.
Comment 37 Claus Prüfer 2025-04-22 17:47:20 UTC
I am using Devuan current (also Debian current) and it does not provide 6.x KDevelop versions.
Also a bug should be fixed, or do you want to live along with a non-fixed bug over years (Windows like)?
This is no good reputation. I could live with a statement like: "The bug is located and fixed in 6.x version", but not with "A workaround exists to disable".
Comment 38 Claus Prüfer 2025-04-22 17:55:18 UTC
Now i get this backtrace on closing KDevelop.

Application: KDevelop (kdevelop), signal: Aborted

[KCrash Handler]
#4  __pthread_kill_implementation (threadid=<optimized out>, signo=signo@entry=6, no_tid=no_tid@entry=0) at ./nptl/pthread_kill.c:44
#5  0x00007f2bdbea9f4f in __pthread_kill_internal (signo=6, threadid=<optimized out>) at ./nptl/pthread_kill.c:78
#6  0x00007f2bdbe5afb2 in __GI_raise (sig=sig@entry=6) at ../sysdeps/posix/raise.c:26
#7  0x00007f2bdbe45472 in __GI_abort () at ./stdlib/abort.c:79
#8  0x00007f2bdbe9e42f in __libc_message (action=action@entry=do_abort, fmt=fmt@entry=0x7f2bdbfb8459 "%s\n") at ../sysdeps/posix/libc_fatal.c:156
#9  0x00007f2bdbeb386a in malloc_printerr (str=str@entry=0x7f2bdbfbb0c8 "free(): invalid next size (fast)") at ./malloc/malloc.c:5660
#10 0x00007f2bdbeb56da in _int_free (av=0x7f2bdbff1c60 <main_arena>, p=0x55825018c800, have_lock=have_lock@entry=0) at ./malloc/malloc.c:4518
#11 0x00007f2bdbeb7f4f in __GI___libc_free (mem=<optimized out>) at ./malloc/malloc.c:3385
#12 0x00007f2bdc2e8f8f in ?? () from /usr/lib/x86_64-linux-gnu/libQt5Core.so.5
#13 0x00007f2bdc2e22df in QObject::destroyed(QObject*) () from /usr/lib/x86_64-linux-gnu/libQt5Core.so.5
#14 0x00007f2bdcfa0a93 in QWidget::~QWidget() () from /usr/lib/x86_64-linux-gnu/libQt5Widgets.so.5
#15 0x00007f2bd9bfbf39 in KateViewInternal::~KateViewInternal() () from /usr/lib/x86_64-linux-gnu/libKF5TextEditor.so.5
#16 0x00007f2bd9bdd82b in KTextEditor::ViewPrivate::~ViewPrivate() () from /usr/lib/x86_64-linux-gnu/libKF5TextEditor.so.5
#17 0x00007f2bd9bddc89 in KTextEditor::ViewPrivate::~ViewPrivate() () from /usr/lib/x86_64-linux-gnu/libKF5TextEditor.so.5
#18 0x00007f2bd9fde3bf in Sublime::View::~View() () from /usr/lib/x86_64-linux-gnu/libKDevPlatformSublime.so.510
#19 0x00007f2bdddc9dd9 in KDevelop::TextView::~TextView() () from /usr/lib/x86_64-linux-gnu/libKDevPlatformShell.so.510
#20 0x00007f2bd9fd05c1 in Sublime::Document::closeViews() () from /usr/lib/x86_64-linux-gnu/libKDevPlatformSublime.so.510
#21 0x00007f2bdddc91d2 in KDevelop::PartDocument::close(KDevelop::IDocument::DocumentSaveMode) () from /usr/lib/x86_64-linux-gnu/libKDevPlatformShell.so.510
#22 0x00007f2bdddd4ba2 in KDevelop::DocumentController::cleanup() () from /usr/lib/x86_64-linux-gnu/libKDevPlatformShell.so.510
#23 0x00007f2bdddaab5e in KDevelop::Core::cleanup() () from /usr/lib/x86_64-linux-gnu/libKDevPlatformShell.so.510
#24 0x00007f2bdddaae5a in KDevelop::Core::shutdown() () from /usr/lib/x86_64-linux-gnu/libKDevPlatformShell.so.510
#25 0x00007f2bddd8d21b in KDevelop::MainWindow::~MainWindow() () from /usr/lib/x86_64-linux-gnu/libKDevPlatformShell.so.510
#26 0x00007f2bddd8d279 in KDevelop::MainWindow::~MainWindow() () from /usr/lib/x86_64-linux-gnu/libKDevPlatformShell.so.510
#27 0x00007f2bdc2dd4ff in QObject::event(QEvent*) () from /usr/lib/x86_64-linux-gnu/libQt5Core.so.5
#28 0x00007f2bd9efb307 in KXmlGuiWindow::event(QEvent*) () from /usr/lib/x86_64-linux-gnu/libKF5XmlGui.so.5
#29 0x00007f2bdcf62fae in QApplicationPrivate::notify_helper(QObject*, QEvent*) () from /usr/lib/x86_64-linux-gnu/libQt5Widgets.so.5
#30 0x00007f2bdc2b1738 in QCoreApplication::notifyInternal2(QObject*, QEvent*) () from /usr/lib/x86_64-linux-gnu/libQt5Core.so.5
#31 0x00007f2bdc2b46c1 in QCoreApplicationPrivate::sendPostedEvents(QObject*, int, QThreadData*) () from /usr/lib/x86_64-linux-gnu/libQt5Core.so.5
#32 0x00007f2bdc30a193 in ?? () from /usr/lib/x86_64-linux-gnu/libQt5Core.so.5
#33 0x00007f2bd7fd47a9 in g_main_context_dispatch () from /usr/lib/x86_64-linux-gnu/libglib-2.0.so.0
#34 0x00007f2bd7fd4a38 in ?? () from /usr/lib/x86_64-linux-gnu/libglib-2.0.so.0
#35 0x00007f2bd7fd4acc in g_main_context_iteration () from /usr/lib/x86_64-linux-gnu/libglib-2.0.so.0
#36 0x00007f2bdc309876 in QEventDispatcherGlib::processEvents(QFlags<QEventLoop::ProcessEventsFlag>) () from /usr/lib/x86_64-linux-gnu/libQt5Core.so.5
#37 0x00007f2bdc2b01bb in QEventLoop::exec(QFlags<QEventLoop::ProcessEventsFlag>) () from /usr/lib/x86_64-linux-gnu/libQt5Core.so.5
#38 0x00007f2bdc2b8316 in QCoreApplication::exec() () from /usr/lib/x86_64-linux-gnu/libQt5Core.so.5
#39 0x00005582342c1699 in ?? ()
#40 0x00007f2bdbe4624a in __libc_start_call_main (main=main@entry=0x5582342bccc0, argc=argc@entry=1, argv=argv@entry=0x7ffcf56a8668) at ../sysdeps/nptl/libc_start_call_main.h:58
#41 0x00007f2bdbe46305 in __libc_start_main_impl (main=0x5582342bccc0, argc=1, argv=0x7ffcf56a8668, init=<optimized out>, fini=<optimized out>, rtld_fini=<optimized out>, stack_end=0x7ffcf56a8658) at ../csu/libc-start.c:360
#42 0x00005582342c2281 in ?? ()
[Inferior 1 (process 6468) detached]
Comment 39 Igor Kushnir 2025-04-22 18:10:53 UTC
(In reply to Claus Prüfer from comment #37)
> I am using Devuan current (also Debian current) and it does not provide 6.x
> KDevelop versions.
> Also a bug should be fixed, or do you want to live along with a non-fixed
> bug over years (Windows like)?
> This is no good reputation. I could live with a statement like: "The bug is
> located and fixed in 6.x version", but not with "A workaround exists to
> disable".
I don't know whether the bug is present in KDevelop 6.x. I could never reproduce it even in 5.x. 

(In reply to Claus Prüfer from comment #38)
> Now i get this backtrace on closing KDevelop.

> #16 0x00007f2bd9bdd82b in KTextEditor::ViewPrivate::~ViewPrivate() () from
> /usr/lib/x86_64-linux-gnu/libKF5TextEditor.so.5
> #17 0x00007f2bd9bddc89 in KTextEditor::ViewPrivate::~ViewPrivate() () from
> /usr/lib/x86_64-linux-gnu/libKF5TextEditor.so.5
> #18 0x00007f2bd9fde3bf in Sublime::View::~View() () from
> /usr/lib/x86_64-linux-gnu/libKDevPlatformSublime.so.510
> #19 0x00007f2bdddc9dd9 in KDevelop::TextView::~TextView() () from
This backtrace looks similar to those reported in Bug 439963 and Bug 480162. 

If you reproduce and fix either crash in KDevelop 6, please create a merge request.
Comment 40 Igor Kushnir 2025-04-22 18:12:46 UTC
*** Bug 503178 has been marked as a duplicate of this bug. ***
Comment 41 Christoph Cullmann 2025-04-22 18:52:30 UTC
We tried to reproduce the accessibility crashes and we fixed some things for 6.x, but I don't think there was ever a proper way to reproduce all  reported crashes to be sure we got all.
Comment 42 Claus Prüfer 2025-04-23 06:50:07 UTC
Yes, i know it is not easy to detect this kind of bug. I try to demystify it since years, but still no clue.

What i did currently: i switched to XFCE window manager (X11) with QT integration and disabled "all" plugins except "KDE File Manager Integration" and "Python Support" ("kdevelop-python" Debian package also installed). Also disabled Background Parser: problem gone. But: it crashed right after pressing "apply" button after disabling the plugins (and no back-trace was shown).

I also switched to software rendering in one of my development virtual machines: problem seems also to be resolved.
Someone also mentioned that it could be graphics related (opengl / driver?) also a common Linux problem.

Additionally i realized that often when i am working with multiple open files (in multiple splitted areas) that the background parsers (pointers) get puzzled and on click the highlighted areas do not match with the program code anymore. This also could be a null-pointer / de-referencing  or similar problem.

I will try to update / compile a newer KDE / QT version and investigate further.