Bug 392800

Summary: ASSERT: "m_root.isValid()" in file src/Cryptography/MessagePart.cpp, line 188
Product: [Applications] trojita Reporter: Jan Kundrát <jkt>
Component: CryptographyAssignee: Trojita default assignee <trojita-bugs>
Status: RESOLVED FIXED    
Severity: normal CC: vidra.jonas
Priority: NOR    
Version: git   
Target Milestone: ---   
Platform: Other   
OS: Linux   
Latest Commit: Version Fixed In:

Description Jan Kundrát 2018-04-06 13:16:30 UTC
This apparently happened during a resume cycle:

(gdb) bt
#0  0x00007ff0d62be21b in __GI_raise (sig=sig@entry=6) at ../sysdeps/unix/sysv/linux/raise.c:54
#1  0x00007ff0d62bf8b1 in __GI_abort () at abort.c:89
#2  0x00007ff0d701a99e in qt_message_fatal (context=..., message=<synthetic pointer>...)
    at /var/tmp/portage/dev-qt/qtcore-5.9.9999/work/qtcore-5.9.9999/src/corelib/global/qlogging.cpp:1690
#3  QMessageLogger::fatal (this=this@entry=0x7fff92d751d0, msg=msg@entry=0x7ff0d72df038 "ASSERT: \"%s\" in file %s, line %d")
    at /var/tmp/portage/dev-qt/qtcore-5.9.9999/work/qtcore-5.9.9999/src/corelib/global/qlogging.cpp:796
#4  0x00007ff0d7014c45 in qt_assert (assertion=<optimized out>, file=<optimized out>, line=<optimized out>)
    at /var/tmp/portage/dev-qt/qtcore-5.9.9999/work/qtcore-5.9.9999/src/corelib/global/qglobal.cpp:3077
#5  0x0000000000535e50 in QtPrivate::QFunctorSlotObject<Cryptography::TopLevelMessage::fetchChildren(Cryptography::MessageModel*)::$_0, 1, QtPrivate::List<QModelIndex const&>, void>::impl(int, QtPrivate::QSlotObjectBase*, QObject*, void**, bool*) ()
#6  0x00007ff0d7246505 in QtPrivate::QSlotObjectBase::call (a=0x7fff92d75370, r=0x1ea9a10, this=0x303b760)
    at ../../include/QtCore/../../../qtcore-5.9.9999/src/corelib/kernel/qobject_impl.h:101
#7  QMetaObject::activate (sender=sender@entry=0x1ab5a00, signalOffset=<optimized out>, local_signal_index=local_signal_index@entry=10, argv=argv@entry=0x7fff92d75370)
    at /var/tmp/portage/dev-qt/qtcore-5.9.9999/work/qtcore-5.9.9999/src/corelib/kernel/qobject.cpp:3749
#8  0x00007ff0d7246aa5 in QMetaObject::activate (sender=sender@entry=0x1ab5a00, m=m@entry=0x7ff0d7474540 <QAbstractItemModel::staticMetaObject>, 
    local_signal_index=local_signal_index@entry=10, argv=argv@entry=0x7fff92d75370)
    at /var/tmp/portage/dev-qt/qtcore-5.9.9999/work/qtcore-5.9.9999/src/corelib/kernel/qobject.cpp:3628
#9  0x00007ff0d71b7ccc in QAbstractItemModel::rowsInserted (this=this@entry=0x1ab5a00, _t1=..., _t2=1, _t3=11, _t4=...) at .moc/moc_qabstractitemmodel.cpp:603
#10 0x00007ff0d71c102c in QAbstractItemModel::endInsertRows (this=0x1ab5a00)
    at /var/tmp/portage/dev-qt/qtcore-5.9.9999/work/qtcore-5.9.9999/src/corelib/itemmodels/qabstractitemmodel.cpp:2709
#11 0x00000000005c18b2 in Imap::Mailbox::Model::replaceChildMailboxes(Imap::Mailbox::TreeItemMailbox*, QVector<Imap::Mailbox::TreeItem*> const&) ()
#12 0x00000000005c0f03 in Imap::Mailbox::Model::finalizeList(Imap::Parser*, Imap::Mailbox::TreeItemMailbox*) ()
#13 0x000000000061116e in Imap::Mailbox::ListChildMailboxesTask::handleStateHelper(Imap::Responses::State const*) ()
#14 0x00000000005bd545 in Imap::Mailbox::Model::responseReceived(QMap<Imap::Parser*, Imap::Mailbox::ParserState>::iterator) ()
#15 0x00007ff0d72474da in QObject::event (this=0x1ab5a00, e=<optimized out>)
    at /var/tmp/portage/dev-qt/qtcore-5.9.9999/work/qtcore-5.9.9999/src/corelib/kernel/qobject.cpp:1246
#16 0x00007ff0d7b03d54 in QApplicationPrivate::notify_helper (this=<optimized out>, receiver=0x1ab5a00, e=0x26e4d80)
    at /var/tmp/portage/dev-qt/qtwidgets-5.9.9999/work/qtwidgets-5.9.9999/src/widgets/kernel/qapplication.cpp:3722
#17 0x00007ff0d7b0c4a2 in QApplication::notify (this=0x7fff92d75d90, receiver=0x1ab5a00, e=0x26e4d80)
    at /var/tmp/portage/dev-qt/qtwidgets-5.9.9999/work/qtwidgets-5.9.9999/src/widgets/kernel/qapplication.cpp:3481
#18 0x00007ff0d7216078 in QCoreApplication::notifyInternal2 (receiver=0x1ab5a00, event=event@entry=0x26e4d80)
    at /var/tmp/portage/dev-qt/qtcore-5.9.9999/work/qtcore-5.9.9999/src/corelib/kernel/qcoreapplication.cpp:1018
#19 0x00007ff0d7219237 in QCoreApplication::sendEvent (event=0x26e4d80, receiver=<optimized out>)
    at /var/tmp/portage/dev-qt/qtcore-5.9.9999/work/qtcore-5.9.9999/src/corelib/kernel/qcoreapplication.h:233
#20 QCoreApplicationPrivate::sendPostedEvents (receiver=receiver@entry=0x0, event_type=event_type@entry=0, data=0x18b87b0)
    at /var/tmp/portage/dev-qt/qtcore-5.9.9999/work/qtcore-5.9.9999/src/corelib/kernel/qcoreapplication.cpp:1678
#21 0x00007ff0d721980e in QCoreApplication::sendPostedEvents (receiver=receiver@entry=0x0, event_type=event_type@entry=0)
    at /var/tmp/portage/dev-qt/qtcore-5.9.9999/work/qtcore-5.9.9999/src/corelib/kernel/qcoreapplication.cpp:1532
#22 0x00007ff0d7273369 in postEventSourceDispatch (s=0x1917300)
    at /var/tmp/portage/dev-qt/qtcore-5.9.9999/work/qtcore-5.9.9999/src/corelib/kernel/qeventdispatcher_glib.cpp:276
#23 0x00007ff0d186c80c in g_main_dispatch (context=0x7ff0c40016f0) at /var/tmp/portage/dev-libs/glib-2.48.2/work/glib-2.48.2/glib/gmain.c:3154
#24 g_main_context_dispatch (context=context@entry=0x7ff0c40016f0) at /var/tmp/portage/dev-libs/glib-2.48.2/work/glib-2.48.2/glib/gmain.c:3769
#25 0x00007ff0d186cb18 in g_main_context_iterate (context=context@entry=0x7ff0c40016f0, block=block@entry=1, dispatch=dispatch@entry=1, self=<optimized out>)
    at /var/tmp/portage/dev-libs/glib-2.48.2/work/glib-2.48.2/glib/gmain.c:3840
#26 0x00007ff0d186cc21 in g_main_context_iteration (context=0x7ff0c40016f0, may_block=1) at /var/tmp/portage/dev-libs/glib-2.48.2/work/glib-2.48.2/glib/gmain.c:3901
#27 0x00007ff0d7272e9d in QEventDispatcherGlib::processEvents (this=0x1912c60, flags=...)
    at /var/tmp/portage/dev-qt/qtcore-5.9.9999/work/qtcore-5.9.9999/src/corelib/kernel/qeventdispatcher_glib.cpp:423
#28 0x00007ff0d72141ba in QEventLoop::exec (this=this@entry=0x7fff92d75be0, flags=..., flags@entry=...)
    at /var/tmp/portage/dev-qt/qtcore-5.9.9999/work/qtcore-5.9.9999/src/corelib/kernel/qeventloop.cpp:212
#29 0x00007ff0d721dd48 in QCoreApplication::exec () at /var/tmp/portage/dev-qt/qtcore-5.9.9999/work/qtcore-5.9.9999/src/corelib/kernel/qcoreapplication.cpp:1291
#30 0x0000000000454e08 in main ()
Comment 1 Jan Kundrát 2019-02-12 10:20:23 UTC
*** Bug 404227 has been marked as a duplicate of this bug. ***
Comment 2 Jan Kundrát 2019-02-24 16:20:03 UTC
Patch is available for review at https://gerrit.vesnicky.cesnet.cz/r/1012
Comment 3 Jan Kundrát 2019-03-10 12:22:57 UTC
Git commit 27bf90aa5beb37db30b9ed61fb5ce6574f18f229 by Jan Kundrát.
Committed on 24/02/2019 at 15:58.
Pushed by gerrit into branch 'master'.

crypto: do not assert-crash on disappearing messages

This is quite unlikely to be hit in real world (I've only hit this once,
and there's one other bug report about this), but if we get reconnected
(and mailboxes trashed) at just the wrong moment when a message would
normally be populated based on remote server's responses, the code would
assert crash here.

This is mainly a blind fix, I have not put much effort into trying to
come up with a solid autotest for this.
Change-Id: I3b7539bebc5de0b5c10c4c05d683cd746aca2402

M  +3    -0    src/Cryptography/MessagePart.cpp

https://commits.kde.org/trojita/27bf90aa5beb37db30b9ed61fb5ce6574f18f229