Bug 365610 - Assert in plasmashell sometimes when creating an activity
Summary: Assert in plasmashell sometimes when creating an activity
Status: RESOLVED FIXED
Alias: None
Product: kactivitymanagerd
Classification: Unmaintained
Component: general (other bugs)
Version First Reported In: unspecified
Platform: Other Linux
: NOR crash
Target Milestone: ---
Assignee: Ivan Čukić
URL:
Keywords:
Depends on:
Blocks:
 
Reported: 2016-07-13 13:45 UTC by Marco Martin
Modified: 2016-07-16 17:31 UTC (History)
1 user (show)

See Also:
Latest Commit:
Version Fixed/Implemented In:
Sentry Crash Report:


Attachments

Note You need to log in before you can comment on or make changes to this bug.
Description Marco Martin 2016-07-13 13:45:29 UTC
there is an assert in ActivitiesModel sometimes when creating an activity, with the following backtrace:

    Thread 1 (Thread 0x7fcbea67d800 (LWP 16433)):
    [KCrash Handler]
    #5  0x00007fcbe29ce187 in raise () from /lib64/libc.so.6
    #6  0x00007fcbe29cf538 in abort () from /lib64/libc.so.6
    #7  0x00007fcbe369772d in qt_message_fatal (context=..., message=...) at global/qlogging.cpp:1680
    #8  0x00007fcbe3693a6e in QMessageLogger::fatal (this=0x7fff42a73f80, msg=0x7fcbe39c82f0 "ASSERT: \"%s\" in file %s, line %d") at global/qlogging.cpp:793
    #9  0x00007fcbe368cc84 in qt_assert (assertion=0x7fcbe3a80f14 "first >= 0", file=0x7fcbe3a80c48 "itemmodels/qabstractitemmodel.cpp", line=2640) at global/qglobal.cpp:3063
    #10 0x00007fcbe3884413 in QAbstractItemModel::beginInsertRows (this=0x1401460, parent=..., first=-778728, last=-778728) at itemmodels/qabstractitemmodel.cpp:2640
    #11 0x00007fcbe989d315 in KActivities::ActivitiesModelPrivate::showActivity (this=0x1783640, activityInfo=..., notifyClients=true) at /home/diau/git/kf5/frameworks/kactivities/src/lib/activitiesmodel.cpp:310
    #12 0x00007fcbe989ca83 in KActivities::ActivitiesModelPrivate::onActivityAdded (this=0x1783640, id=..., notifyClients=true) at /home/diau/git/kf5/frameworks/kactivities/src/lib/activitiesmodel.cpp:222
    #13 0x00007fcbe989c3e7 in KActivities::ActivitiesModel::ActivitiesModel(QVector<KActivities::Info::State>, QObject*)::{lambda(QString const&)#2}::operator()(QString const&) const () at /home/diau/git/kf5/frameworks/kactivities/src/lib/activitiesmodel.cpp:171
    #14 0x00007fcbe989edf6 in QtPrivate::FunctorCall<QtPrivate::IndexesList<0>, QtPrivate::List<const QString&>, void, KActivities::ActivitiesModel::ActivitiesModel(QVector<KActivities::Info::State>, QObject*)::__lambda7>::call(KActivities::ActivitiesModel::__lambda7 &, void **) (f=..., arg=0x7fff42a744a0) at /opt/kde5/include/QtCore/qobjectdefs_impl.h:501
    #15 0x00007fcbe989ec2c in QtPrivate::Functor<KActivities::ActivitiesModel::ActivitiesModel(QVector<KActivities::Info::State>, QObject*)::__lambda7, 1>::call<QtPrivate::List<QString const&>, void>(KActivities::ActivitiesModel::__lambda7 &, void *, void **) (f=..., arg=0x7fff42a744a0) at /opt/kde5/include/QtCore/qobjectdefs_impl.h:558
    #16 0x00007fcbe989ea0b in QtPrivate::QFunctorSlotObject<KActivities::ActivitiesModel::ActivitiesModel(QVector<KActivities::Info::State>, QObject*)::__lambda7, 1, QtPrivate::List<const QString&>, void>::impl(int, QtPrivate::QSlotObjectBase *, QObject *, void **, bool *) (which=1, this_=0x1415770, r=0x1401460, a=0x7fff42a744a0, ret=0x0) at /opt/kde5/include/QtCore/qobject_impl.h:198
    #17 0x00007fcbe3927b23 in QtPrivate::QSlotObjectBase::call (this=0x1415770, r=0x1401460, a=0x7fff42a744a0) at ../../include/QtCore/../../src/corelib/kernel/qobject_impl.h:130
    #18 0x00007fcbe3924a98 in QMetaObject::activate (sender=0x1783650, signalOffset=3, local_signal_index=2, argv=0x7fff42a744a0) at kernel/qobject.cpp:3723



Reproducible: Sometimes
Comment 1 Ivan Čukić 2016-07-13 21:31:17 UTC
Do you have the output message of the assert?

Since I have no idea how this is possible since the index (at least from what I can tell) can not be < 0, I've changed .begin()/.end() to .cbegin()/.cend() to avoid potential detachment of the QVector, though it should have not be shared anywhere.

Can you update and retest?
Comment 2 Ivan Čukić 2016-07-16 17:26:48 UTC
This was fun to detect - for some reason, this issue only appeared in plasma and *never* in the test app. Strange but true. Will push the fix in a moment.
Comment 3 Ivan Čukić 2016-07-16 17:31:53 UTC
Git commit b81bbb87f69a7daef8539a8a2c308d18b3450615 by Ivan Čukić.
Committed on 16/07/2016 at 17:30.
Pushed by ivan into branch 'master'.

Method for inserting into QFlatSet now returns index along with the iterator

Something strange was happening in Plasma where iterator - begin was
sometimes returning an invalid value.

M  +4    -7    src/lib/activitiesmodel.cpp
M  +12   -15   src/utils/qflatset.h

http://commits.kde.org/kactivities/b81bbb87f69a7daef8539a8a2c308d18b3450615