Application: kmail (2.0.89) KDE Platform Version: 4.5.76 (4.6 >= 20101111) Qt Version: 4.7.1 Operating System: Linux 2.6.33.6-desktop-2mnb i686 Distribution: "Mandriva Linux 2011.0" -- Information about the crash: - What I was doing when the application crashed: I opened the filters list and i navigated in it using arrows keys, then it suddenly crashed. -- Backtrace: Application: KMail (kmail), signal: Aborted [Current thread is 1 (Thread 0xb20276e0 (LWP 14500))] Thread 2 (Thread 0xaf49fb70 (LWP 14521)): #0 0xffffe424 in __kernel_vsyscall () #1 0xb5a2e05c in pthread_cond_wait@@GLIBC_2.3.2 () from /lib/i686/libpthread.so.0 #2 0xb5f796ed in pthread_cond_wait@@GLIBC_2.3.2 () from /lib/i686/libc.so.6 #3 0xb3914127 in WTF::TCMalloc_PageHeap::runScavengerThread(void*) () from /usr/lib/libQtWebKit.so.4 #4 0xb5a29ea9 in start_thread () from /lib/i686/libpthread.so.0 #5 0xb5f6a9fe in clone () from /lib/i686/libc.so.6 Thread 1 (Thread 0xb20276e0 (LWP 14500)): [KCrash Handler] #7 0xffffe424 in __kernel_vsyscall () #8 0xb5ebf291 in raise () from /lib/i686/libc.so.6 #9 0xb5ec0dbe in abort () from /lib/i686/libc.so.6 #10 0xb615a79a in qt_message_output (msgType=QtFatalMsg, buf=0xa3fc250 "ASSERT: \"list.size() == 1\" in file /home/mandrake/rpm/BUILD/kdepim-4.5.76svn1196728/mailcommon/folderrequester.cpp, line 132") at global/qglobal.cpp:2282 #11 0xb615a99f in qt_message (msgType=QtFatalMsg, msg=0xb62c739c "ASSERT: \"%s\" in file %s, line %d", ap=0xbff65454 "\\\330\021\265x\333\021\265\204") at global/qglobal.cpp:2328 #12 0xb615aab8 in qFatal (msg=0xb62c739c "ASSERT: \"%s\" in file %s, line %d") at global/qglobal.cpp:2511 #13 0xb615ab45 in qt_assert (assertion=0xb511d85c "list.size() == 1", file=0xb511db78 "/home/mandrake/rpm/BUILD/kdepim-4.5.76svn1196728/mailcommon/folderrequester.cpp", line=132) at global/qglobal.cpp:2027 #14 0xb50dfbef in MailCommon::FolderRequester::slotCollectionsReceived (this=0x9ceb7f8, list=...) at /usr/src/debug/kdepim-4.5.76svn1196728/mailcommon/folderrequester.cpp:132 #15 0xb50dfd23 in MailCommon::FolderRequester::qt_metacall (this=0x9ceb7f8, _c=QMetaObject::InvokeMetaMethod, _id=<value optimized out>, _a=0xbff655c8) at /usr/src/debug/kdepim-4.5.76svn1196728/build/mailcommon/folderrequester.moc:81 #16 0xb62658ad in QMetaObject::metacall (object=0x9ceb7f8, cl=QMetaObject::InvokeMetaMethod, idx=29, argv=0xbff655c8) at kernel/qmetaobject.cpp:237 #17 0xb627508c in QMetaObject::activate (sender=0xa3fc640, m=0xb55f4094, local_signal_index=0, argv=0xbff655c8) at kernel/qobject.cpp:3272 #18 0xb5447bf5 in Akonadi::CollectionFetchJob::collectionsReceived (this=0xa3fc640, _t1=...) at /usr/src/debug/kdepimlibs-4.5.76svn1196755/build/akonadi/collectionfetchjob.moc:92 #19 0xb544954a in Akonadi::CollectionFetchJobPrivate::timeout() () from /usr/lib/libakonadi-kde.so.4 #20 0xb5447e58 in Akonadi::CollectionFetchJob::qt_metacall (this=0xa3fc640, _c=QMetaObject::InvokeMetaMethod, _id=2, _a=0xbff656f8) at /usr/src/debug/kdepimlibs-4.5.76svn1196755/build/akonadi/collectionfetchjob.moc:80 #21 0xb62658ad in QMetaObject::metacall (object=0xa3fc640, cl=QMetaObject::InvokeMetaMethod, idx=37, argv=0xbff656f8) at kernel/qmetaobject.cpp:237 #22 0xb627508c in QMetaObject::activate (sender=0xa3fc640, m=0xb737b548, local_signal_index=3, argv=0xbff656f8) at kernel/qobject.cpp:3272 #23 0xb71ba095 in KJob::result (this=0xa3fc640, _t1=0xa3fc640) at /usr/src/debug/kdelibs-4.5.76svn1197335/build/kdecore/kjob.moc:194 #24 0xb71ba0e7 in KJob::emitResult (this=0xa3fc640) at /usr/src/debug/kdelibs-4.5.76svn1197335/kdecore/jobs/kjob.cpp:312 #25 0xb54ba7c3 in Akonadi::JobPrivate::delayedEmitResult (this=0xa2bb3a0) at /usr/src/debug/kdepimlibs-4.5.76svn1196755/akonadi/job.cpp:144 #26 0xb54bb578 in Akonadi::Job::qt_metacall (this=0xa3fc640, _c=QMetaObject::InvokeMetaMethod, _id=6, _a=0x9f6fde8) at /usr/src/debug/kdepimlibs-4.5.76svn1196755/build/akonadi/job.moc:91 #27 0xb5447e02 in Akonadi::CollectionFetchJob::qt_metacall (this=0xa3fc640, _c=QMetaObject::InvokeMetaMethod, _id=34, _a=0x9f6fde8) at /usr/src/debug/kdepimlibs-4.5.76svn1196755/build/akonadi/collectionfetchjob.moc:73 #28 0xb62658ad in QMetaObject::metacall (object=0xa3fc640, cl=QMetaObject::InvokeMetaMethod, idx=34, argv=0x9f6fde8) at kernel/qmetaobject.cpp:237 #29 0xb62704e5 in QMetaCallEvent::placeMetaCall (this=0x9508a08, object=0xa3fc640) at kernel/qobject.cpp:534 #30 0xb6274b8f in QObject::event (this=0xa3fc640, e=0x9508a08) at kernel/qobject.cpp:1211 #31 0xb64c7c74 in QApplicationPrivate::notify_helper (this=0x9108a68, receiver=0xa3fc640, e=0x9508a08) at kernel/qapplication.cpp:4445 #32 0xb64ccb87 in QApplication::notify (this=0xbff6601c, receiver=0xa3fc640, e=0x9508a08) at kernel/qapplication.cpp:3845 #33 0xb7568d98 in KApplication::notify (this=0xbff6601c, receiver=0xa3fc640, event=0x9508a08) at /usr/src/debug/kdelibs-4.5.76svn1197335/kdeui/kernel/kapplication.cpp:311 #34 0xb625f0ee in QCoreApplication::notifyInternal (this=0xbff6601c, receiver=0xa3fc640, event=0x9508a08) at kernel/qcoreapplication.cpp:732 #35 0xb6262e6c in sendEvent (receiver=0x0, event_type=0, data=0x90ddd20) at kernel/qcoreapplication.h:215 #36 QCoreApplicationPrivate::sendPostedEvents (receiver=0x0, event_type=0, data=0x90ddd20) at kernel/qcoreapplication.cpp:1373 #37 0xb6262fbc in QCoreApplication::sendPostedEvents (receiver=0x0, event_type=0) at kernel/qcoreapplication.cpp:1266 #38 0xb628d994 in sendPostedEvents (s=0x910ad10) at kernel/qcoreapplication.h:220 #39 postEventSourceDispatch (s=0x910ad10) at kernel/qeventdispatcher_glib.cpp:277 #40 0xb4728a49 in g_main_dispatch (context=0x910ac90) at gmain.c:2149 #41 g_main_context_dispatch (context=0x910ac90) at gmain.c:2702 #42 0xb4729250 in g_main_context_iterate (context=0x910ac90, block=1, dispatch=1, self=<value optimized out>) at gmain.c:2780 #43 0xb472950a in g_main_context_iteration (context=0x910ac90, may_block=1) at gmain.c:2843 #44 0xb628db1b in QEventDispatcherGlib::processEvents (this=0x90dd810, flags=...) at kernel/qeventdispatcher_glib.cpp:415 #45 0xb657de7a in QGuiEventDispatcherGlib::processEvents (this=0x90dd810, flags=...) at kernel/qguieventdispatcher_glib.cpp:204 #46 0xb625e2fd in QEventLoop::processEvents (this=0xbff65f34, flags=...) at kernel/qeventloop.cpp:149 #47 0xb625e579 in QEventLoop::exec (this=0xbff65f34, flags=...) at kernel/qeventloop.cpp:201 #48 0xb6263090 in QCoreApplication::exec () at kernel/qcoreapplication.cpp:1009 #49 0xb64c59a4 in QApplication::exec () at kernel/qapplication.cpp:3719 #50 0x0804a750 in main (argc=1, argv=0xbff66114) at /usr/src/debug/kdepim-4.5.76svn1196728/kmail/main.cpp:145 Reported using DrKonqi
commit fc6a85794370da8bd2322205b5ba16010d6229db branch master Author: Tobias Koenig <tokoe@kde.org> Date: Sat Jan 1 18:06:40 2011 +0100 Do not crash on stale collection Do not crash if the CollectionFetchJob does not return the expected collection because the folder has been removed in the meantime. BUG: 257352 diff --git a/mailcommon/folderrequester.cpp b/mailcommon/folderrequester.cpp index 41b2d63..1836ade 100644 --- a/mailcommon/folderrequester.cpp +++ b/mailcommon/folderrequester.cpp @@ -119,22 +119,36 @@ void FolderRequester::setFolder( const Akonadi::Collection&col ) setCollectionFullPath( mCollection ); mFolderId = QString::number( mCollection.id() ); Akonadi::CollectionFetchJob *job = new Akonadi::CollectionFetchJob( mCollection, Akonadi::CollectionFetchJob::Base, this ); - connect( job, SIGNAL( collectionsReceived( Akonadi::Collection::List ) ), - this, SLOT( slotCollectionsReceived( Akonadi::Collection::List ) ) ); + connect( job, SIGNAL( result( KJob* ) ), + this, SLOT( slotCollectionsReceived( KJob* ) ) ); } else if ( !mMustBeReadWrite ) // the Local Folders root node was selected edit->setText( i18n("Local Folders") ); emit folderChanged( mCollection ); } -void FolderRequester::slotCollectionsReceived( const Akonadi::Collection::List& list ) +void FolderRequester::slotCollectionsReceived( KJob *job ) { - Q_ASSERT( list.size() == 1 ); // we only start jobs on a single collection - const Akonadi::Collection col = list.first(); - // in case this is still the collection we are interested in, update - if ( col.id() == mCollection.id() ) { - mCollection = col; - setCollectionFullPath( col ); + if ( job->error() ) { + mCollection = Akonadi::Collection(); + edit->setText( i18n( "Please select a folder" ) ); + return; + } + + const Akonadi::CollectionFetchJob *fetchJob = qobject_cast<Akonadi::CollectionFetchJob*>( job ); + const Akonadi::Collection::List collections = fetchJob->collections(); + + if ( !collections.isEmpty() ) { + const Akonadi::Collection collection = collections.first(); + // in case this is still the collection we are interested in, update + if ( collection.id() == mCollection.id() ) { + mCollection = collection; + setCollectionFullPath( collection ); + } + } else { + // the requested collection doesn't exists anymore + mCollection = Akonadi::Collection(); + edit->setText( i18n( "Please select a folder" ) ); } } diff --git a/mailcommon/folderrequester.h b/mailcommon/folderrequester.h index 65627d3..3dd42c2 100644 --- a/mailcommon/folderrequester.h +++ b/mailcommon/folderrequester.h @@ -35,8 +35,10 @@ #include <ksharedconfig.h> #include <akonadi/collection.h> +#include <QtGui/QKeyEvent> #include <QtGui/QWidget> -#include <QKeyEvent> + +class KJob; namespace MailCommon { @@ -95,7 +97,7 @@ class Kernel; void slotOpenDialog(); /** Update the information we have about the current folder. */ - void slotCollectionsReceived( const Akonadi::Collection::List& ); + void slotCollectionsReceived( KJob* ); signals: /** Emitted when the folder changed */