Bug 402439 - Model error with Kickoff RunnerModel
Summary: Model error with Kickoff RunnerModel
Status: RESOLVED FIXED
Alias: None
Product: plasmashell
Classification: Plasma
Component: Application Launcher (Kickoff) (show other bugs)
Version: master
Platform: Other Linux
: NOR normal
Target Milestone: 1.0
Assignee: David Edmundson
URL:
Keywords:
: 410651 411610 (view as bug list)
Depends on:
Blocks:
 
Reported: 2018-12-21 19:01 UTC by David Edmundson
Modified: 2023-08-18 17:20 UTC (History)
3 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 David Edmundson 2018-12-21 19:01:13 UTC
In an attempt to check there's no bug our side with the common plasma crash in kickoff I attached QAbstractItemModelTester to our model.

Unpredictably (one in every few launches) I do get a model error:

#0  0x00007ffff1191d7f in raise () at /usr/lib/libc.so.6
#1  0x00007ffff117c672 in abort () at /usr/lib/libc.so.6
#2  0x00007ffff16eb25b in qt_message_fatal(QtMsgType, QMessageLogContext const&, QString const&) (context=..., message=...)
    at /home/david/projects/qt5/qtbase/src/corelib/global/qlogging.cpp:1840
#3  0x00007ffff16ebfe9 in QMessageLogger::fatal(char const*, ...) const
    (this=this@entry=0x7fffffffc260, msg=msg@entry=0x7fffcc048760 <QAbstractItemModelTesterPrivate::compare<QVariant, QVariant>(QVariant const&, QVariant const&, char const*, char const*, char const*, int)::formatString> "FAIL! Compared values are not the same:\n   Actual (%s) %s\n   Expected (%s) %s\n   (%s:%d)") at /home/david/projects/qt5/qtbase/src/corelib/global/qlogging.cpp:880
#4  0x00007fffcc03dd77 in QAbstractItemModelTesterPrivate::compare<QVariant, QVariant>(QVariant const&, QVariant const&, char const*, char const*, char const*, int)
    (this=this@entry=0x555557fc1ab0, t1=..., t2=..., actual=actual@entry=0x7fffcc044830 "model->data(model->index(start - 1, 0, c.parent))", expected=expected@entry=0x7fffcc046112 "c.last", file=file@entry=0x7fffcc044500 "/home/david/projects/qt5/qtbase/src/testlib/qabstractitemmodeltester.cpp", line=746) at ../../include/QtCore/../../../../qt5/qtbase/src/corelib/global/qlogging.h:91
#5  0x00007fffcc03af0c in QAbstractItemModelTesterPrivate::rowsRemoved(QModelIndex const&, int, int)
    (this=0x555557fc1ab0, parent=..., start=16, end=25) at /usr/include/c++/8.2.1/bits/atomic_base.h:390
#6  0x00007fffcc03b141 in QAbstractItemModelTester::<lambda(const QModelIndex&, int, int)>::operator()
    (end=<optimized out>, start=<optimized out>, parent=..., __closure=<optimized out>)
    at /home/david/projects/qt5/qtbase/src/testlib/qabstractitemmodeltester.cpp:262
#7  0x00007fffcc03b141 in QtPrivate::FunctorCall<QtPrivate::IndexesList<0, 1, 2>, QtPrivate::List<const QModelIndex&, int, int>, void, QAbstractItemModelTester::QAbstractItemModelTester(QAbstractItemModel*, QAbstractItemModelTester::FailureReportingMode, QObject*)::<lambda(const QModelIndex&, int, int)> >::call (arg=<optimized out>, f=...)
    at ../../include/QtCore/../../../../qt5/qtbase/src/corelib/kernel/qobjectdefs_impl.h:128
#8  0x00007fffcc03b141 in QtPrivate::Functor<QAbstractItemModelTester::QAbstractItemModelTester(QAbstractItemModel*, QAbstractItemModelTester::FailureReportingMode, QObject*)::<lambda(const QModelIndex&, int, int)>, 3>::call<QtPrivate::List<QModelIndex const&, int, int>, void>
    (arg=<optimized out>, f=...) at ../../include/QtCore/../../../../qt5/qtbase/src/corelib/kernel/qobjectdefs_impl.h:238
#9  0x00007fffcc03b141 in QtPrivate::QFunctorSlotObject<QAbstractItemModelTester::QAbstractItemModelTester(QAbstractItemModel*, QAbstractItemModelTester::FailureReportingMode, QObject*)::<lambda(const QModelIndex&, int, int)>, 3, QtPrivate::List<const QModelIndex&, int, int>, void>::impl(int, QtPrivate::QSlotObjectBase *, QObject *, void **, bool *)
    (which=<optimized out>, this_=<optimized out>, r=<optimized out>, a=<optimized out>, ret=<optimized out>)
    at ../../include/QtCore/../../../../qt5/qtbase/src/corelib/kernel/qobjectdefs_impl.h:421
#10 0x00007ffff18ee860 in QtPrivate::QSlotObjectBase::call(QObject*, void**) (a=<optimized out>, r=0x555557f683c0, this=0x555558008b10)
    at ../../include/QtCore/../../../../qt5/qtbase/src/corelib/kernel/qobjectdefs_impl.h:376
#11 0x00007ffff18ee860 in QMetaObject::activate(QObject*, int, int, void**)
    (sender=sender@entry=0x555558099cd0, signalOffset=<optimized out>, local_signal_index=local_signal_index@entry=12, argv=argv@entry=0x7fffffffc4f0) at /home/david/projects/qt5/qtbase/src/corelib/kernel/qobject.cpp:3754
#12 0x00007ffff18eecbd in QMetaObject::activate(QObject*, QMetaObject const*, int, void**)
    (sender=sender@entry=0x555558099cd0, m=m@entry=0x7ffff1b6c4a0 <QAbstractItemModel::staticMetaObject>, local_signal_index=local_signal_index@entry=12, argv=argv@entry=0x7fffffffc4f0) at /home/david/projects/qt5/qtbase/src/corelib/kernel/qobject.cpp:3633
#13 0x00007ffff1871245 in QAbstractItemModel::rowsRemoved(QModelIndex const&, int, int, QAbstractItemModel::QPrivateSignal)
    (this=this@entry=0x555558099cd0, _t1=..., _t2=<optimized out>, _t3=<optimized out>, _t4=...) at .moc/moc_qabstractitemmodel.cpp:601
#14 0x00007ffff18799f5 in QAbstractItemModel::endRemoveRows() (this=0x555558099cd0)
    at /home/david/projects/qt5/qtbase/src/corelib/itemmodels/qabstractitemmodel.cpp:2786
#15 0x00007fffc41a703a in RunnerMatchesModel::setMatches(QList<Plasma::QueryMatch> const&) (this=0x555558099cd0, matches=...)
    at /home/david/projects/kde5/src/kde/workspace/plasma-desktop/applets/kicker/plugin/runnermatchesmodel.cpp:241
#16 0x00007fffc41a0a0d in RunnerModel::matchesChanged(QList<Plasma::QueryMatch> const&) (this=0x555557d33220, matches=...)
    at /home/david/projects/kde5/src/kde/workspace/plasma-desktop/applets/kicker/plugin/runnermodel.cpp:264
#17 0x00007fffc41c0a1a in RunnerModel::qt_static_metacall(QObject*, QMetaObject::Call, int, void**)
    (_o=0x555557d33220, _c=QMetaObject::InvokeMetaMethod, _id=8, _a=0x7fffffffcb50)
    at applets/kicker/kickerplugin_autogen/7RBZBFH7CH/moc_runnermodel.cpp:152
#18 0x00007ffff18eea1b in QMetaObject::activate(QObject*, int, int, void**)
    (sender=sender@entry=0x555557aac360, signalOffset=<optimized out>, local_signal_index=local_signal_index@entry=0, argv=argv@entry=0x7fffffffcb50) at /home/david/projects/qt5/qtbase/src/corelib/kernel/qobject.cpp:3771
#19 0x00007ffff18eecbd in QMetaObject::activate(QObject*, QMetaObject const*, int, void**)
    (sender=0x555557aac360, m=<optimized out>, local_signal_index=0, argv=0x7fffffffcb50)
    at /home/david/projects/qt5/qtbase/src/corelib/kernel/qobject.cpp:3633
#20 0x00007fffb8feb8a3 in Plasma::RunnerManager::matchesChanged(QList<Plasma::QueryMatch> const&) (this=0x555557aac360, _t1=...)
    at src/KF5Runner_autogen/include/moc_runnermanager.cpp:191
#21 0x00007fffb8fee518 in Plasma::RunnerManagerPrivate::matchesChanged() (this=0x555557ab1310)
    at /home/david/projects/kde5/src/frameworks/krunner/src/runnermanager.cpp:92
#22 0x00007fffb8feb6f0 in Plasma::RunnerManager::qt_static_metacall(QObject*, QMetaObject::Call, int, void**)
    (_o=0x555557aac360, _c=QMetaObject::InvokeMetaMethod, _id=8, _a=0x7fffffffcd20)
    at src/KF5Runner_autogen/include/moc_runnermanager.cpp:126
#23 0x00007ffff18eea1b in QMetaObject::activate(QObject*, int, int, void**)
    (sender=sender@entry=0x555557ab1338, signalOffset=<optimized out>, local_signal_index=local_signal_index@entry=0, argv=argv@entry=0x7fffffffcd20) at /home/david/projects/qt5/qtbase/src/corelib/kernel/qobject.cpp:3771
#24 0x00007ffff18eecbd in QMetaObject::activate(QObject*, QMetaObject const*, int, void**)
    (sender=sender@entry=0x555557ab1338, m=m@entry=0x7ffff1b6dca0 <QTimer::staticMetaObject>, local_signal_index=local_signal_index@entry=0, argv=argv@entry=0x7fffffffcd20) at /home/david/projects/qt5/qtbase/src/corelib/kernel/qobject.cpp:3633
#25 0x00007ffff18fb9ab in QTimer::timeout(QTimer::QPrivateSignal) (this=this@entry=0x555557ab1338, _t1=...) at .moc/moc_qtimer.cpp:200
#26 0x00007ffff18fbbb1 in QTimer::timerEvent(QTimerEvent*) (this=0x555557ab1338, e=<optimized out>)
    at /home/david/projects/qt5/qtbase/src/corelib/kernel/qtimer.cpp:255
#27 0x00007ffff18ef10c in QObject::event(QEvent*) (this=0x555557ab1338, e=<optimized out>)
    at /home/david/projects/qt5/qtbase/src/corelib/kernel/qobject.cpp:1232
#28 0x00007ffff2ada46d in QApplicationPrivate::notify_helper(QObject*, QEvent*)
    (this=this@entry=0x555555868560, receiver=receiver@entry=0x555557ab1338, e=e@entry=0x7fffffffd010)
    at /home/david/projects/qt5/qtbase/src/widgets/kernel/qapplication.cpp:3726
#29 0x00007ffff2ae236d in QApplication::notify(QObject*, QEvent*) (this=0x7fffffffd9e0, receiver=0x555557ab1338, e=0x7fffffffd010)
    at /home/david/projects/qt5/qtbase/src/widgets/kernel/qapplication.cpp:3098
#30 0x00007ffff18bd415 in QCoreApplication::notifyInternal2(QObject*, QEvent*) (receiver=0x555557ab1338, event=event@entry=0x7fffffffd010)
    at /home/david/projects/qt5/qtbase/src/corelib/kernel/qcoreapplication.cpp:1047
#31 0x00007ffff191bfe6 in QCoreApplication::sendEvent(QObject*, QEvent*) (event=0x7fffffffd010, receiver=<optimized out>)
    at ../../include/QtCore/../../../../qt5/qtbase/src/corelib/kernel/qcoreapplication.h:234
#32 0x00007ffff191bfe6 in QTimerInfoList::activateTimers() (this=0x5555558b3920)
    at /home/david/projects/qt5/qtbase/src/corelib/kernel/qtimerinfo_unix.cpp:643
#33 0x00007ffff191c82c in timerSourceDispatch(GSource*, GSourceFunc, gpointer) (source=<optimized out>)
    at /home/david/projects/qt5/qtbase/src/corelib/kernel/qeventdispatcher_glib.cpp:182
#34 0x00007fffebe603cf in g_main_context_dispatch () at /usr/lib/libglib-2.0.so.0
#35 0x00007fffebe61f89 in  () at /usr/lib/libglib-2.0.so.0
#36 0x00007fffebe61fce in g_main_context_iteration () at /usr/lib/libglib-2.0.so.0
#37 0x00007ffff191cbbc in QEventDispatcherGlib::processEvents(QFlags<QEventLoop::ProcessEventsFlag>) (this=0x5555558b86e0, flags=...)
    at /home/david/projects/qt5/qtbase/src/corelib/kernel/qeventdispatcher_glib.cpp:422
#38 0x00007fffea31aebf in QPAEventDispatcherGlib::processEvents(QFlags<QEventLoop::ProcessEventsFlag>) (this=0x5555558b86e0, flags=...)
    at /home/david/projects/qt5/qtbase/src/platformsupport/eventdispatchers/qeventdispatcher_glib.cpp:69
#39 0x00007ffff18bb327 in QEventLoop::processEvents(QFlags<QEventLoop::ProcessEventsFlag>) (this=this@entry=0x7fffffffd290, flags=..., 
    flags@entry=...) at /usr/include/c++/8.2.1/bits/atomic_base.h:707
#40 0x00007ffff18bb77f in QEventLoop::exec(QFlags<QEventLoop::ProcessEventsFlag>) (this=this@entry=0x7fffffffd290, flags=flags@entry=...)
    at ../../include/QtCore/../../../../qt5/qtbase/src/corelib/global/qflags.h:122
#41 0x00007ffff18c5872 in QCoreApplication::exec() () at ../../include/QtCore/../../../../qt5/qtbase/src/corelib/global/qflags.h:120
#42 0x00007ffff1c8e282 in QGuiApplication::exec() () at /home/david/projects/qt5/qtbase/src/gui/kernel/qguiapplication.cpp:1762
#43 0x00007ffff2ada3db in QApplication::exec() () at /home/david/projects/qt5/qtbase/src/widgets/kernel/qapplication.cpp:2900
#44 0x000055555557a99a in main(int, char**) (argc=2, argv=0x7fffffffdaf8)
    at /home/david/projects/kde5/src/kde/workspace/plasma-workspace/shell/main.cpp:212



Relevant patch on plasma-desktop to attach model tester: https://phabricator.kde.org/P283

Haven't investigated yet.
Comment 1 David Edmundson 2019-01-03 11:48:17 UTC
Git commit 9371a7c96d4722b93b49b18df7b21780f2a9ad38 by David Edmundson.
Committed on 03/01/2019 at 11:48.
Pushed by davidedmundson into branch 'master'.

Fix model updates in RunnerMatchesModel

Summary:
RunnerMatchesModel is backed by a list. When this list changes
RunnerManagerModel add/removes the new number of rows then called
dataChanged on everything that remained.

It's a common pattern, but not a great one. Especially with QtQuick
where moving a delegate is faster than updating all the properties of an
existing one - unfortunately I can't find a nice solution to do this
properly in linear time.

The problem with the current code is we update the entire list in the
insert/remove rows. This is a violation of the model rules as we're
updating rows outside the rows listed inside begin/remove rows.

It works, but Qt's model test fails.

We also have a lot of duplicates of a crash in QtQuick after runner
model changes, bug 369430. I think it could be related, but can't
prove anything.

This patch updates the rows that exist in both the before and after
models before adding/removing the remaining rows.

Test Plan:
Added Qt model tester in https://phabricator.kde.org/P283
It now passes.

Reviewers: #plasma, hein

Reviewed By: #plasma, hein

Subscribers: hein, apol, plasma-devel

Tags: #plasma

Differential Revision: https://phabricator.kde.org/D17725

M  +5    -8    applets/kicker/plugin/runnermatchesmodel.cpp

https://commits.kde.org/plasma-desktop/9371a7c96d4722b93b49b18df7b21780f2a9ad38
Comment 2 David Edmundson 2019-08-15 20:58:45 UTC
Git commit a2fe5212126c05f8638709d640bc1ba1589026b0 by David Edmundson.
Committed on 15/08/2019 at 20:58.
Pushed by davidedmundson into branch 'Plasma/5.12'.

Fix model updates in RunnerMatchesModel

Summary:
RunnerMatchesModel is backed by a list. When this list changes
RunnerManagerModel add/removes the new number of rows then called
dataChanged on everything that remained.

It's a common pattern, but not a great one. Especially with QtQuick
where moving a delegate is faster than updating all the properties of an
existing one - unfortunately I can't find a nice solution to do this
properly in linear time.

The problem with the current code is we update the entire list in the
insert/remove rows. This is a violation of the model rules as we're
updating rows outside the rows listed inside begin/remove rows.

It works, but Qt's model test fails.

We also have a lot of duplicates of a crash in QtQuick after runner
model changes, bug 369430. I think it could be related, but can't
prove anything.

This patch updates the rows that exist in both the before and after
models before adding/removing the remaining rows.

Test Plan:
Added Qt model tester in https://phabricator.kde.org/P283
It now passes.

Reviewers: #plasma, hein

Reviewed By: #plasma, hein

Subscribers: hein, apol, plasma-devel

Tags: #plasma

Differential Revision: https://phabricator.kde.org/D17725

M  +5    -8    applets/kicker/plugin/runnermatchesmodel.cpp

https://commits.kde.org/plasma-desktop/a2fe5212126c05f8638709d640bc1ba1589026b0
Comment 3 David Edmundson 2019-08-15 21:16:19 UTC
*** Bug 410651 has been marked as a duplicate of this bug. ***
Comment 4 David Edmundson 2019-09-05 12:43:02 UTC
*** Bug 411610 has been marked as a duplicate of this bug. ***