Bug 271882

Summary: cl crashes after accounts were removed
Product: [Unmaintained] telepathy Reporter: Alin M Elena <alinm.elena>
Component: contactlistAssignee: Unassigned bugs mailing-list <unassigned-bugs>
Status: RESOLVED FIXED    
Severity: crash CC: kde
Priority: NOR    
Version: unspecified   
Target Milestone: 0.4.0   
Platform: unspecified   
OS: Linux   
Latest Commit: Version Fixed In:
Sentry Crash Report:

Description Alin M Elena 2011-04-28 00:26:59 UTC
Application: telepathy-kde-contactlist (0.1)
KDE Platform Version: 4.6.41 (4.7 >= 20110106) "release 1"
Qt Version: 4.7.2
Operating System: Linux 2.6.39-rc4-9-desktop x86_64
Distribution: "openSUSE 12.1 Milestone 0 (x86_64)"

-- Information about the crash:
cl crashes after accounts were removed and added again

The crash can be reproduced every time.

-- Backtrace:
Application: Telepathy KDE Contact List (telepathy-kde-contactlist), signal: Segmentation fault
[KCrash Handler]
#6  MainWidget::selectAvatarFromAccount (this=0x7c8990, accountUID=...) at /usr/src/debug/telepathy-contact-list-0.1git.1303643145/main-widget.cpp:855
#7  0x000000000042ded8 in MainWidget::onNewAccountAdded (this=0x7c8990, account=...) at /usr/src/debug/telepathy-contact-list-0.1git.1303643145/main-widget.cpp:351
#8  0x000000000042e1d9 in MainWidget::onAccountManagerReady (this=0x7c8990, op=<optimized out>) at /usr/src/debug/telepathy-contact-list-0.1git.1303643145/main-widget.cpp:287
#9  0x000000000043175c in MainWidget::qt_metacall (this=0x7c8990, _c=QMetaObject::InvokeMetaMethod, _id=<optimized out>, _a=0x7fff86f99a80) at /usr/src/debug/telepathy-contact-list-0.1git.1303643145/build/main-widget.moc:140
#10 0x00007ffc54fd5b4f in QMetaObject::activate(QObject*, QMetaObject const*, int, void**) () from /usr/lib64/libQtCore.so.4
#11 0x00007ffc5693500f in Tp::PendingOperation::finished (this=<optimized out>, _t1=0x96ba50) at /usr/src/debug/telepathy-qt4-0.5.13.1303671001/build/TelepathyQt4/_gen/pending-operation.moc.hpp:98
#12 0x00007ffc56935051 in Tp::PendingOperation::emitFinished (this=0x96ba50) at /usr/src/debug/telepathy-qt4-0.5.13.1303671001/TelepathyQt4/pending-operation.cpp:116
#13 0x00007ffc56935cec in Tp::PendingOperation::qt_metacall (this=0x96ba50, _c=QMetaObject::InvokeMetaMethod, _id=<optimized out>, _a=0x917770) at /usr/src/debug/telepathy-qt4-0.5.13.1303671001/build/TelepathyQt4/_gen/pending-operation.moc.hpp:86
#14 0x00007ffc56936820 in Tp::PendingReady::qt_metacall (this=0x96ba50, _c=QMetaObject::InvokeMetaMethod, _id=<optimized out>, _a=0x917770) at /usr/src/debug/telepathy-qt4-0.5.13.1303671001/build/TelepathyQt4/_gen/pending-ready.moc.hpp:67
#15 0x00007ffc54fd546a in QObject::event(QEvent*) () from /usr/lib64/libQtCore.so.4
#16 0x00007ffc54389124 in QApplicationPrivate::notify_helper(QObject*, QEvent*) () from /usr/lib64/libQtGui.so.4
#17 0x00007ffc543916ca in QApplication::notify(QObject*, QEvent*) () from /usr/lib64/libQtGui.so.4
#18 0x00007ffc56353b66 in KApplication::notify(QObject*, QEvent*) () from /usr/lib64/libkdeui.so.5
#19 0x00007ffc54fc155c in QCoreApplication::notifyInternal(QObject*, QEvent*) () from /usr/lib64/libQtCore.so.4
#20 0x00007ffc54fc4d55 in QCoreApplicationPrivate::sendPostedEvents(QObject*, int, QThreadData*) () from /usr/lib64/libQtCore.so.4
#21 0x00007ffc54fec183 in ?? () from /usr/lib64/libQtCore.so.4
#22 0x00007ffc4f6b3bd3 in g_main_dispatch (context=0x68c0e0) at gmain.c:2440
#23 g_main_context_dispatch (context=0x68c0e0) at gmain.c:3013
#24 0x00007ffc4f6b43b0 in g_main_context_iterate (context=0x68c0e0, block=1, dispatch=1, self=<optimized out>) at gmain.c:3091
#25 0x00007ffc4f6b4650 in g_main_context_iteration (context=0x68c0e0, may_block=1) at gmain.c:3154
#26 0x00007ffc54fec31f in QEventDispatcherGlib::processEvents(QFlags<QEventLoop::ProcessEventsFlag>) () from /usr/lib64/libQtCore.so.4
#27 0x00007ffc5442eb7e in ?? () from /usr/lib64/libQtGui.so.4
#28 0x00007ffc54fc0992 in QEventLoop::processEvents(QFlags<QEventLoop::ProcessEventsFlag>) () from /usr/lib64/libQtCore.so.4
#29 0x00007ffc54fc0ba5 in QEventLoop::exec(QFlags<QEventLoop::ProcessEventsFlag>) () from /usr/lib64/libQtCore.so.4
#30 0x00007ffc54fc500b in QCoreApplication::exec() () from /usr/lib64/libQtCore.so.4
#31 0x00000000004298dc in main (argc=2, argv=0x7fff86f9a808) at /usr/src/debug/telepathy-contact-list-0.1git.1303643145/main.cpp:60

Reported using DrKonqi
Comment 1 David Edmundson 2011-04-28 00:32:34 UTC
My money is on it being this line:


Tp::Avatar avatar = qobject_cast<AccountsModelItem*>(m_model->accountItemForId(accountUID))->data(AccountsModel::AvatarRole).value<Tp::Avatar>();

What if "accountItemForId()" returns 0? (which it can do, especially if an account has just been deleted and the config file says to load its avatar)

Whenever you do anything than can return 0, it's best to check before ever calling "->" on it.
Comment 2 Martin Klapetek 2011-06-09 13:04:08 UTC
Git commit b4ec627f1e61012db3a618c8fd919385d94952d8 by Martin Klapetek.
Committed on 09/06/2011 at 13:03.
Pushed by mklapetek into branch 'master'.

Fix a crash when the config contains invalid account ID for setting avatar.

Reviewed-by: David Edmundson
BUG: 271882

M  +13   -1    main-widget.cpp     

http://commits.kde.org/telepathy-contact-list/b4ec627f1e61012db3a618c8fd919385d94952d8