Bug 451593 - rkward constantly crashes in argument hint - ktexteditor 5.92.0, but not ktexteditor 5.91.0
Summary: rkward constantly crashes in argument hint - ktexteditor 5.92.0, but not ktex...
Status: RESOLVED FIXED
Alias: None
Product: frameworks-ktexteditor
Classification: Frameworks and Libraries
Component: general (show other bugs)
Version: 5.92.0
Platform: Arch Linux Linux
: NOR crash
Target Milestone: ---
Assignee: KWrite Developers
URL:
Keywords: drkonqi
Depends on:
Blocks:
 
Reported: 2022-03-16 21:32 UTC by Francisco Cribari
Modified: 2022-03-21 20:43 UTC (History)
4 users (show)

See Also:
Latest Commit:
Version Fixed In:


Attachments

Note You need to log in before you can comment on or make changes to this bug.
Description Francisco Cribari 2022-03-16 21:32:12 UTC
Application: rkward (0.7.2)

Qt Version: 5.15.3
Frameworks Version: 5.92.0
Operating System: Linux 5.16.14-zen1-1-zen x86_64
Windowing System: X11
Distribution: "Arch Linux"
DrKonqi: 5.24.3 [KCrashBackend]

-- Information about the crash:
- What I was doing when the application crashed:

I was typing an R instruction in the script window. I have been getting these crashes regularly.

The crash can be reproduced every time.

-- Backtrace:
Application: RKWard (rkward), signal: Segmentation fault
Content of s_kcrashErrorMessage: {_M_t = {<std::__uniq_ptr_impl<char, std::default_delete<char []> >> = {_M_t = std::tuple containing = {[1] = 0x0, [2] = {<No data fields>}}}, <No data fields>}}
[KCrash Handler]
#6  0x00007fe413247f34 in QModelIndex::sibling(int, int) const (this=0x7ffcfc38b958, arow=690569216, acolumn=0) at /usr/include/qt/QtCore/qabstractitemmodel.h:446
#7  0x00007fe413255c19 in KateCompletionModel::mapToSource(QModelIndex const&) const (this=<optimized out>, proxyIndex=...) at /usr/src/debug/ktexteditor-5.92.0/src/completion/katecompletionmodel.cpp:919
#8  0x00007fe413266c81 in KateArgumentHintModel::contextMatchQuality(QModelIndex const&) const (this=0x7ffcfc38b9e0, index=<optimized out>) at /usr/src/debug/ktexteditor-5.92.0/src/completion/kateargumenthintmodel.cpp:309
#9  0x00007fe41325ea83 in ExpandingWidgetModel::matchColor(QModelIndex const&) const (this=this@entry=0x55d12a162a60, index=...) at /usr/src/debug/ktexteditor-5.92.0/src/completion/expandingtree/expandingwidgetmodel.cpp:46
#10 0x00007fe41325eca8 in ExpandingWidgetModel::data(QModelIndex const&, int) const (this=this@entry=0x55d12a162a60, index=..., role=role@entry=8) at /usr/src/debug/ktexteditor-5.92.0/src/completion/expandingtree/expandingwidgetmodel.cpp:81
#11 0x00007fe413264c08 in KateArgumentHintModel::data(QModelIndex const&, int) const (this=0x55d12a162a60, index=..., role=8) at /usr/src/debug/ktexteditor-5.92.0/src/completion/kateargumenthintmodel.cpp:217
#12 0x00007fe41251aca0 in QModelIndex::data(int) const (arole=8, this=0x7ffcfc38bf70) at ../../include/QtCore/../../src/corelib/itemmodels/qabstractitemmodel.h:460
#13 QStyledItemDelegate::initStyleOption(QStyleOptionViewItem*, QModelIndex const&) const (this=0x55d12a176390, option=0x7ffcfc38bdf0, index=...) at itemviews/qstyleditemdelegate.cpp:351
#14 0x00007fe41251e81b in QStyledItemDelegate::sizeHint(QStyleOptionViewItem const&, QModelIndex const&) const (this=this@entry=0x55d12a176390, option=..., index=...) at itemviews/qstyleditemdelegate.cpp:410
#15 0x00007fe4132655d8 in ArgumentHintDelegate::sizeHint(QStyleOptionViewItem const&, QModelIndex const&) const (this=0x55d12a176390, option=<optimized out>, index=...) at /usr/src/debug/ktexteditor-5.92.0/src/completion/kateargumenthinttree.cpp:55
#16 0x00007fe41256a54d in QTreeView::indexRowSizeHint(QModelIndex const&) const (this=0x7ffcfc38bf70, index=<optimized out>) at itemviews/qtreeview.cpp:2995
#17 0x00007fe41256a732 in QTreeViewPrivate::itemHeight(int) const (item=0, this=0x55d12a16c230) at ../../include/QtWidgets/5.15.3/QtWidgets/private/../../../../../src/widgets/itemviews/qtreeview_p.h:85
#18 QTreeViewPrivate::itemHeight(int) const (this=this@entry=0x55d12a16c230, item=item@entry=1) at itemviews/qtreeview.cpp:3460
#19 0x00007fe41256e7f4 in QTreeViewPrivate::updateScrollBars() (this=0x55d12a16c230) at itemviews/qtreeview.cpp:3711
#20 0x00007fe41256eb3b in QTreeView::updateGeometries() (this=0x55d12a16bc10) at itemviews/qtreeview.cpp:2834
#21 0x00007fe4124f3592 in QAbstractItemView::doItemsLayout() (this=0x55d12a16bc10) at itemviews/qabstractitemview.cpp:1222
#22 0x00007fe4125639c3 in QTreeView::doItemsLayout() (this=0x55d12a16bc10) at itemviews/qtreeview.cpp:2102
#23 0x00007fe41256ba22 in QAbstractItemViewPrivate::executePostedLayout() const (this=0x55d12a16c230) at ../../include/QtWidgets/5.15.3/QtWidgets/private/../../../../../src/widgets/itemviews/qabstractitemview_p.h:94
#24 QAbstractItemViewPrivate::executePostedLayout() const (this=0x55d12a16c230) at ../../include/QtWidgets/5.15.3/QtWidgets/private/../../../../../src/widgets/itemviews/qabstractitemview_p.h:226
#25 QTreeView::sizeHintForColumn(int) const (this=0x55d12a16bc10, column=0) at itemviews/qtreeview.cpp:2857
#26 0x00007fe41326575e in KateArgumentHintTree::sizeHintForColumn(int) const (column=0, this=0x55d12a16bc10) at /usr/src/debug/ktexteditor-5.92.0/src/completion/kateargumenthinttree.cpp:124
#27 KateArgumentHintTree::resizeColumns() (this=0x55d12a16bc10) at /usr/src/debug/ktexteditor-5.92.0/src/completion/kateargumenthinttree.cpp:231
#28 KateArgumentHintTree::updateGeometry(QRect) (this=0x55d12a16bc10, geom=...) at /usr/src/debug/ktexteditor-5.92.0/src/completion/kateargumenthinttree.cpp:161
#29 0x00007fe411728463 in QtPrivate::QSlotObjectBase::call(QObject*, void**) (a=0x7ffcfc38c580, r=<optimized out>, this=0x55d12a181ff0, 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=0x55d12a162a60, signal_index=26, argv=0x7ffcfc38c580) at kernel/qobject.cpp:3886
#31 0x00007fe413263f22 in KateArgumentHintModel::contentStateChanged(bool) (_t1=<optimized out>, this=0x55d12a162a60) at /usr/src/debug/build/src/KF5TextEditor_autogen/23UEYSZXD4/moc_kateargumenthintmodel.cpp:141
#32 KateArgumentHintModel::buildRows() (this=0x55d12a162a60) at /usr/src/debug/ktexteditor-5.92.0/src/completion/kateargumenthintmodel.cpp:80
#33 0x00007fe411728463 in QtPrivate::QSlotObjectBase::call(QObject*, void**) (a=0x7ffcfc38c660, r=<optimized out>, this=0x55d12a16bf70, this=<optimized out>, r=<optimized out>, a=<optimized out>) at ../../include/QtCore/../../src/corelib/kernel/qobjectdefs_impl.h:398
#34 doActivate<false>(QObject*, int, void**) (sender=0x55d12a160f40, signal_index=27, argv=0x7ffcfc38c660) at kernel/qobject.cpp:3886
#35 0x00007fe4132591e6 in KateCompletionModel::hideOrShowGroup(KateCompletionModel::Group*, bool) (this=this@entry=0x55d12a160f40, g=<optimized out>, notifyModel=notifyModel@entry=false) at /usr/src/debug/ktexteditor-5.92.0/src/completion/katecompletionmodel.cpp:1154
#36 0x00007fe41325c6b0 in KateCompletionModel::createGroups() (this=0x55d12a160f40) at /usr/src/debug/ktexteditor-5.92.0/src/completion/katecompletionmodel.cpp:612
#37 0x00007fe411728463 in QtPrivate::QSlotObjectBase::call(QObject*, void**) (a=0x7ffcfc38c930, r=<optimized out>, this=0x55d129e75890, this=<optimized out>, r=<optimized out>, a=<optimized out>) at ../../include/QtCore/../../src/corelib/kernel/qobjectdefs_impl.h:398
#38 doActivate<false>(QObject*, int, void**) (sender=0x55d12a1ca280, signal_index=21, argv=0x7ffcfc38c930) at kernel/qobject.cpp:3886
#39 0x00007fe4116b4052 in QAbstractItemModel::modelReset(QAbstractItemModel::QPrivateSignal) (this=<optimized out>, _t1=...) at .moc/moc_qabstractitemmodel.cpp:648
#40 0x000055d1258b227a in  ()
#41 0x00007fe411728463 in QtPrivate::QSlotObjectBase::call(QObject*, void**) (a=0x7ffcfc38cbf0, r=<optimized out>, this=0x55d12a070400, this=<optimized out>, r=<optimized out>, a=<optimized out>) at ../../include/QtCore/../../src/corelib/kernel/qobjectdefs_impl.h:398
#42 doActivate<false>(QObject*, int, void**) (sender=0x55d12a186720, signal_index=3, argv=0x7ffcfc38cbf0) at kernel/qobject.cpp:3886
#43 0x00007fe41172a69f in QTimer::timeout(QTimer::QPrivateSignal) (this=<optimized out>, _t1=...) at .moc/moc_qtimer.cpp:205
#44 0x00007fe41171b766 in QObject::event(QEvent*) (this=0x55d12a186720, e=0x7ffcfc38cd90) at kernel/qobject.cpp:1291
#45 0x00007fe4122921c6 in QApplicationPrivate::notify_helper(QObject*, QEvent*) (this=<optimized out>, receiver=0x55d12a186720, e=0x7ffcfc38cd90) at kernel/qapplication.cpp:3637
#46 0x00007fe4116f75aa in QCoreApplication::notifyInternal2(QObject*, QEvent*) (receiver=0x55d12a186720, event=0x7ffcfc38cd90) at kernel/qcoreapplication.cpp:1064
#47 0x00007fe411742dd5 in QTimerInfoList::activateTimers() (this=0x55d1277c3430) at kernel/qtimerinfo_unix.cpp:643
#48 0x00007fe4117433ba in timerSourceDispatch(GSource*, GSourceFunc, gpointer) (source=<optimized out>) at kernel/qeventdispatcher_glib.cpp:183
#49 0x00007fe40bfafee3 in g_main_dispatch (context=0x7fe3f8005010) at ../glib/glib/gmain.c:3381
#50 g_main_context_dispatch (context=0x7fe3f8005010) at ../glib/glib/gmain.c:4099
#51 0x00007fe40c0060f9 in g_main_context_iterate.constprop.0 (context=context@entry=0x7fe3f8005010, block=block@entry=1, dispatch=dispatch@entry=1, self=<optimized out>) at ../glib/glib/gmain.c:4175
#52 0x00007fe40bfad455 in g_main_context_iteration (context=0x7fe3f8005010, may_block=1) at ../glib/glib/gmain.c:4240
#53 0x00007fe41174357a in QEventDispatcherGlib::processEvents(QFlags<QEventLoop::ProcessEventsFlag>) (this=0x55d1277d18b0, flags=...) at kernel/qeventdispatcher_glib.cpp:423
#54 0x00007fe4116ef88b in QEventLoop::exec(QFlags<QEventLoop::ProcessEventsFlag>) (this=0x7ffcfc38d030, flags=...) at ../../include/QtCore/../../src/corelib/global/qflags.h:69
#55 0x00007fe4116fafd7 in QCoreApplication::exec() () at ../../include/QtCore/../../src/corelib/global/qflags.h:121
#56 0x000055d125840d63 in  ()
#57 0x00007fe410f80310 in __libc_start_call_main () at /usr/lib/libc.so.6
#58 0x00007fe410f803c1 in __libc_start_main_impl () at /usr/lib/libc.so.6
#59 0x000055d125841eb5 in _start ()
[Inferior 1 (process 3146) detached]

Reported using DrKonqi
Comment 1 Thomas Friedrichsmeier 2022-03-16 21:46:04 UTC
Thanks for reporting.

> The crash can be reproduced every time.

You mean every time you type an instruction in the script window, you are getting the crash? Or is it "only" something that happens often? Or does this happen, when you type something specific (what)?

I have never seen this bug, before. Which does not mean it isn't real, only that I need some more info to find out, where to start looking.
Comment 2 Francisco Cribari 2022-03-16 22:06:58 UTC
(In reply to Thomas Friedrichsmeier from comment #1)
> Thanks for reporting.
> 
> > The crash can be reproduced every time.
> 
> You mean every time you type an instruction in the script window, you are
> getting the crash? Or is it "only" something that happens often? Or does
> this happen, when you type something specific (what)?
> 
> I have never seen this bug, before. Which does not mean it isn't real, only
> that I need some more info to find out, where to start looking.

What I mean is that the crashes happen frequently. For instance, I had over ten crashes today. I start rkward, click on File... select the option Open R Script File... and then open a file that contains R instructions. Then I execute some instructions by highlighting them and then pressing CTRL + Enter. For instance, 

setwd("~/courses/et588-mr2/programs/")
getwd() 

Most crashes happen when I am typing in the script window, e.g., I type 

pdf(coo

and then rkward crashes.
Comment 3 Thomas Friedrichsmeier 2022-03-16 22:37:11 UTC
Thanks for clarifying. I'll have to test with KTexteditor 5.92, maybe the problem is there.

Things you can do to help track down the bug (or to work around it):

- Try disabling some completion types in Settings->Configure RKWard->Script Editor. Perhaps you can pin down, which ones exactly are causing the crash.
- Try compiling the git master version of RKWard.
- If you have that option, try running on a system with an older version of KTextEditor.
- Should you notice any pattern (e.g. fully repeatable crash on a particular instruction), please let me know (I have just tried repeatedly typing a bunch of variations of "pdf(coo", but was unable to produce a crash).
Comment 4 Francisco Cribari 2022-03-16 23:05:03 UTC
(In reply to Thomas Friedrichsmeier from comment #3)
> Thanks for clarifying. I'll have to test with KTexteditor 5.92, maybe the
> problem is there.
> 
> Things you can do to help track down the bug (or to work around it):
> 
> - Try disabling some completion types in Settings->Configure RKWard->Script
> Editor. Perhaps you can pin down, which ones exactly are causing the crash.
> - Try compiling the git master version of RKWard.
> - If you have that option, try running on a system with an older version of
> KTextEditor.
> - Should you notice any pattern (e.g. fully repeatable crash on a particular
> instruction), please let me know (I have just tried repeatedly typing a
> bunch of variations of "pdf(coo", but was unable to produce a crash).

I unticked the option "Function call tip" in the "Code Completion / Code Hints" tab of Settings -> Configure RKWard... -> Script editor. Result: no crashes. 

I then activated back "Function call tip". Result: The crashes returned. 

I then unticked "Object name completion" (all other options activated). Result: No crashes. 

I then unticked "Auto word completion (all other options activated). Result: Crashes. 

I then unticked "Function argument completion (all other options activated). Result: No crashes.

I then unticked "Filename completion (all other options activated). Result: Crashes.
Comment 5 Francisco Cribari 2022-03-17 09:26:05 UTC
UPDATE: I've just experienced a crash with the option "Function argument completion" unticked (all other options activated).
Comment 6 Thomas Friedrichsmeier 2022-03-17 18:43:44 UTC
Ok, this looks like a bug in ktexteditor. I installed arch linux, getting ktexteditor 5.92.0. This results in the crash you describe.

Did

  pacman -U https://archive.archlinux.org/packages/k/ktexteditor/ktexteditor-5.91.0-1-x86_64.pkg.tar.zst

started again, and the crash went away.
Comment 7 Thomas Friedrichsmeier 2022-03-17 21:07:52 UTC
git bisect pins down the problem to one of the following commits:

https://invent.kde.org/frameworks/ktexteditor/-/commit/cfac04723df556d492b9dea901be8411c59662cc  (does not compile)
https://invent.kde.org/frameworks/ktexteditor/-/commit/e1eec8e6000861de2459451e219ab322468b6906  (first commit showing the crash)
Comment 8 Waqar Ahmed 2022-03-18 05:15:29 UTC
Git commit ad82b876016367bd9765185dba84600985e5d0fd by Waqar Ahmed.
Committed on 18/03/2022 at 05:14.
Pushed by waqar into branch 'master'.

Fix crash with stale indexes

M  +5    -0    src/completion/katecompletionmodel.cpp

https://invent.kde.org/frameworks/ktexteditor/commit/ad82b876016367bd9765185dba84600985e5d0fd
Comment 9 Waqar Ahmed 2022-03-18 05:16:35 UTC
Hi,

Pushed a possible fix. If it is still crashing feel free to reopen with some example R code if possible so that its easy to repro.
Comment 10 Thomas Friedrichsmeier 2022-03-21 20:43:33 UTC
Git commit ca1f3ed68bbd6173758f13a890c8fddad0c8b88e by Thomas Friedrichsmeier.
Committed on 21/03/2022 at 20:42.
Pushed by tfry into branch 'master'.

Disable function call tip when used with ktexteditor 5.92.0

M  +16   -1    rkward/windows/rkcodecompletion.cpp

https://invent.kde.org/education/rkward/commit/ca1f3ed68bbd6173758f13a890c8fddad0c8b88e