Bug 345769

Summary: Unmerging a single contact from person crashes
Product: [Frameworks and Libraries] frameworks-kpeople Reporter: Martin Klapetek <mklapetek>
Component: PersonsModelAssignee: Aleix Pol <aleixpol>
Status: RESOLVED FIXED    
Severity: normal CC: aspotashev
Priority: NOR    
Version: unspecified   
Target Milestone: ---   
Platform: Other   
OS: Linux   
Latest Commit: Version Fixed In:
Sentry Crash Report:

Description Martin Klapetek 2015-04-01 19:46:52 UTC
Somehwere hits an "index out of range" assert.


#0  0x00007ffff2b26e37 in __GI_raise (sig=sig@entry=6) at ../nptl/sysdeps/unix/sysv/linux/raise.c:56
#1  0x00007ffff2b28528 in __GI_abort () at abort.c:89
#2  0x00007ffff347e1cd in qt_message_fatal (context=..., message=...) at global/qlogging.cpp:1414
#3  0x00007ffff347a9d2 in QMessageLogger::fatal (this=0x7fffffffb4a0, msg=0x7ffff37dfdb0 "ASSERT failure in %s: \"%s\", file %s, line %d") at global/qlogging.cpp:639
#4  0x00007ffff3474b02 in qt_assert_x (where=0x7ffff5737df8 "QList<T>::operator[]", what=0x7ffff5737dd8 "index out of range", file=0x7ffff5737db8 "/opt/qt5/include/QtCore/qlist.h", line=486) at global/qglobal.cpp:2818
#5  0x00007ffff572d131 in QList<KPeople::MetaContact>::operator[] (this=0x9641d8, i=-1) at /opt/qt5/include/QtCore/qlist.h:486
#6  0x00007ffff572b145 in KPeople::PersonsModelPrivate::onRemoveContactsFromPerson (this=0x9641b0, contactUri=...) at /home/mck182/ktp-dev/src/kpeople/src/personsmodel.cpp:408
#7  0x00007ffff57301c7 in QtPrivate::FunctorCall<QtPrivate::IndexesList<0>, QtPrivate::List<QString const&>, void, void (KPeople::PersonsModelPrivate::*)(QString const&)>::call (f=
    (void (KPeople::PersonsModelPrivate::*)(KPeople::PersonsModelPrivate * const, const QString &)) 0x7ffff572b0d8 <KPeople::PersonsModelPrivate::onRemoveContactsFromPerson(QString const&)>, o=0x9641b0, arg=0x7fffffffb7a0)
    at /opt/qt5/include/QtCore/qobjectdefs_impl.h:500
#8  0x00007ffff572fc73 in QtPrivate::FunctionPointer<void (KPeople::PersonsModelPrivate::*)(QString const&)>::call<QtPrivate::List<QString const&>, void> (f=
    (void (KPeople::PersonsModelPrivate::*)(KPeople::PersonsModelPrivate * const, const QString &)) 0x7ffff572b0d8 <KPeople::PersonsModelPrivate::onRemoveContactsFromPerson(QString const&)>, o=0x9641b0, arg=0x7fffffffb7a0)
    at /opt/qt5/include/QtCore/qobjectdefs_impl.h:519
#9  0x00007ffff572f5ab in QtPrivate::QSlotObject<void (KPeople::PersonsModelPrivate::*)(QString const&), QtPrivate::List<QString const&>, void>::impl (which=1, this_=0x928630, r=0x9641b0, a=0x7fffffffb7a0, ret=0x0) at /opt/qt5/include/QtCore/qobject_impl.h:143
#10 0x00007ffff374e60d in QtPrivate::QSlotObjectBase::call (this=0x928630, r=0x9641b0, a=0x7fffffffb7a0) at ../../include/QtCore/../../src/corelib/kernel/qobject_impl.h:124
#11 0x00007ffff374b7d8 in QMetaObject::activate (sender=0x92a560, signalOffset=3, local_signal_index=0, argv=0x7fffffffb7a0) at kernel/qobject.cpp:3702
#12 0x00007ffff374b0d4 in QMetaObject::activate (sender=0x92a560, m=0x7ffff5945720 <PersonManager::staticMetaObject>, local_signal_index=0, argv=0x7fffffffb7a0) at kernel/qobject.cpp:3582
#13 0x00007ffff57367cc in PersonManager::contactRemovedFromPerson (this=0x92a560, _t1=...) at /home/mck182/ktp-dev/build/kpeople/src/moc_personmanager_p.cpp:154
#14 0x00007ffff57349f1 in PersonManager::unmergeContact (this=0x92a560, id=...) at /home/mck182/ktp-dev/src/kpeople/src/personmanager.cpp:271
#15 0x00007ffff571bfc9 in KPeople::unmergeContact (uri=...) at /home/mck182/ktp-dev/src/kpeople/src/global.cpp:35
#16 0x000000000046c735 in MainWidget::onMetacontactToggleTriggered (this=0x722910) at /home/mck182/ktp-dev/src/ktp-contact-list/main-widget.cpp:727
#17 0x0000000000485a95 in MainWidget::qt_static_metacall (_o=0x722910, _c=QMetaObject::InvokeMetaMethod, _id=14, _a=0x7fffffffbcc0) at /home/mck182/ktp-dev/build/ktp-contact-list/moc_main-widget.cpp:153
#18 0x00007ffff374b8e2 in QMetaObject::activate (sender=0x863a30, signalOffset=3, local_signal_index=1, argv=0x7fffffffbcc0) at kernel/qobject.cpp:3716
#19 0x00007ffff374b0d4 in QMetaObject::activate (sender=0x863a30, m=0x7ffff56dd7c0 <QAction::staticMetaObject>, local_signal_index=1, argv=0x7fffffffbcc0) at kernel/qobject.cpp:3582
#20 0x00007ffff5091ff0 in QAction::triggered (this=0x863a30, _t1=false) at .moc/moc_qaction.cpp:360
#21 0x00007ffff50914ba in QAction::activate (this=0x863a30, event=QAction::Trigger) at kernel/qaction.cpp:1167
#22 0x00007ffff5092997 in QAction::trigger (this=0x863a30) at kernel/qaction.h:177
#23 0x00007ffff52b1625 in QToolButton::nextCheckState (this=0xa684c0) at widgets/qtoolbutton.cpp:949
#24 0x00007ffff51c03b2 in QAbstractButtonPrivate::click (this=0xa69620) at widgets/qabstractbutton.cpp:516
#25 0x00007ffff51c1922 in QAbstractButton::mouseReleaseEvent (this=0xa684c0, e=0x7fffffffc6a0) at widgets/qabstractbutton.cpp:1132
#26 0x00007ffff52b0317 in QToolButton::mouseReleaseEvent (this=0xa684c0, e=0x7fffffffc6a0) at widgets/qtoolbutton.cpp:609
#27 0x00007ffff50efd12 in QWidget::event (this=0xa684c0, event=0x7fffffffc6a0) at kernel/qwidget.cpp:8656
#28 0x00007ffff51c1760 in QAbstractButton::event (this=0xa684c0, e=0x7fffffffc6a0) at widgets/qabstractbutton.cpp:1089
#29 0x00007ffff52b169c in QToolButton::event (this=0xa684c0, event=0x7fffffffc6a0) at widgets/qtoolbutton.cpp:965
#30 0x00007ffff50a1ffc in QApplicationPrivate::notify_helper (this=0x78bcb0, receiver=0xa684c0, e=0x7fffffffc6a0) at kernel/qapplication.cpp:3722
#31 0x00007ffff509fdb7 in QApplication::notify (this=0x7fffffffd370, receiver=0xa684c0, e=0x7fffffffc6a0) at kernel/qapplication.cpp:3280
#32 0x00007ffff370834c in QCoreApplication::notifyInternal (this=0x7fffffffd370, receiver=0xa684c0, event=0x7fffffffc6a0) at kernel/qcoreapplication.cpp:932
#33 0x00007ffff50a4d73 in QCoreApplication::sendSpontaneousEvent (receiver=0xa684c0, event=0x7fffffffc6a0) at ../../include/QtCore/../../src/corelib/kernel/qcoreapplication.h:231
#34 0x00007ffff509e5eb in QApplicationPrivate::sendMouseEvent (receiver=0xa684c0, event=0x7fffffffc6a0, alienWidget=0xa684c0, nativeWidget=0x722910, buttonDown=0x7ffff570fc70 <qt_button_down>, lastMouseReceiver=..., spontaneous=true) at kernel/qapplication.cpp:2751
#35 0x00007ffff511746c in QWidgetWindow::handleMouseEvent (this=0x904fc0, event=0x7fffffffcd70) at kernel/qwidgetwindow.cpp:506
#36 0x00007ffff511617b in QWidgetWindow::event (this=0x904fc0, event=0x7fffffffcd70) at kernel/qwidgetwindow.cpp:173
#37 0x00007ffff50a1ffc in QApplicationPrivate::notify_helper (this=0x78bcb0, receiver=0x904fc0, e=0x7fffffffcd70) at kernel/qapplication.cpp:3722
#38 0x00007ffff509f562 in QApplication::notify (this=0x7fffffffd370, receiver=0x904fc0, e=0x7fffffffcd70) at kernel/qapplication.cpp:3164
#39 0x00007ffff370834c in QCoreApplication::notifyInternal (this=0x7fffffffd370, receiver=0x904fc0, event=0x7fffffffcd70) at kernel/qcoreapplication.cpp:932
#40 0x00007ffff4970415 in QCoreApplication::sendSpontaneousEvent (receiver=0x904fc0, event=0x7fffffffcd70) at ../../include/QtCore/../../src/corelib/kernel/qcoreapplication.h:231
#41 0x00007ffff496991d in QGuiApplicationPrivate::processMouseEvent (e=0xd7d5d0) at kernel/qguiapplication.cpp:1796
#42 0x00007ffff4968eba in QGuiApplicationPrivate::processWindowSystemEvent (e=0xd7d5d0) at kernel/qguiapplication.cpp:1598
#43 0x00007ffff49527ed in QWindowSystemInterface::sendWindowSystemEvents (flags=...) at kernel/qwindowsysteminterface.cpp:572
#44 0x00007fffe37b8cbc in userEventSourceDispatch (source=0x7d6090) at eventdispatchers/qeventdispatcher_glib.cpp:70
#45 0x00007fffee64ec3d in g_main_context_dispatch () from /lib/x86_64-linux-gnu/libglib-2.0.so.0
#46 0x00007fffee64ef20 in ?? () from /lib/x86_64-linux-gnu/libglib-2.0.so.0
#47 0x00007fffee64efcc in g_main_context_iteration () from /lib/x86_64-linux-gnu/libglib-2.0.so.0
#48 0x00007ffff37811ed in QEventDispatcherGlib::processEvents (this=0x7c5f80, flags=...) at kernel/qeventdispatcher_glib.cpp:418
#49 0x00007fffe37b8ece in QPAEventDispatcherGlib::processEvents (this=0x7c5f80, flags=...) at eventdispatchers/qeventdispatcher_glib.cpp:115
#50 0x00007ffff3705042 in QEventLoop::processEvents (this=0x7fffffffd1c0, flags=...) at kernel/qeventloop.cpp:128
#51 0x00007ffff3705303 in QEventLoop::exec (this=0x7fffffffd1c0, flags=...) at kernel/qeventloop.cpp:204
#52 0x00007ffff3708a24 in QCoreApplication::exec () at kernel/qcoreapplication.cpp:1185
#53 0x00007ffff4968c66 in QGuiApplication::exec () at kernel/qguiapplication.cpp:1532
#54 0x00007ffff509ed83 in QApplication::exec () at kernel/qapplication.cpp:2956
#55 0x000000000046558e in main (argc=1, argv=0x7fffffffd498) at /home/mck182/ktp-dev/src/ktp-contact-list/main.cpp:71
Comment 1 Martin Klapetek 2015-04-03 16:23:20 UTC
Git commit b09bef242680d258a2531a24058a9baf560eb076 by Martin Klapetek.
Committed on 03/04/2015 at 16:22.
Pushed by mklapetek into branch 'Applications/15.04'.

KPeople merging requires Contact URI, not ID

M  +1    -1    main-widget.cpp

http://commits.kde.org/telepathy-contact-list/b09bef242680d258a2531a24058a9baf560eb076
Comment 2 Martin Klapetek 2015-04-03 16:23:29 UTC
Git commit 2e6f9f89a5a224e510271d24dc8c4870b59e22da by Martin Klapetek.
Committed on 03/04/2015 at 16:20.
Pushed by mklapetek into branch 'master'.

Extend the unit tests and fix a bug they uncover

I've been investigating a bug in contact list when unmerging a single
contact from a Person would leave empty rows (and originally would
crash), turns out that removing Contact from Person does not emit the
rows removed signal and so the model then tries to access invalid
contact (and we get "out of bounds" assert).

REVIEW: 123238

CHANGELOG: Fix model not being properly updated after removing a contact from Person

M  +1    -0    autotests/fakecontactsource.cpp
M  +88   -2    autotests/personsmodeltest.cpp
M  +1    -0    autotests/personsmodeltest.h
M  +4    -0    src/personsmodel.cpp

http://commits.kde.org/kpeople/2e6f9f89a5a224e510271d24dc8c4870b59e22da