--===============1659843432== Content-type: multipart/signed; micalg=pgp-sha1; protocol="application/pgp-signature"; boundary=nextPart3292617.3cIELq0SVj Content-transfer-encoding: 7bit --nextPart3292617.3cIELq0SVj Content-Type: multipart/mixed; boundary="Boundary-01=_wRNpEspg/7i+Gcs" Content-Transfer-Encoding: 7bit Content-Disposition: inline --Boundary-01=_wRNpEspg/7i+Gcs Content-Type: text/plain; charset="iso-8859-15" Content-Transfer-Encoding: quoted-printable Content-Disposition: inline Hi Allen, am Freitag, 30. Juni 2006 01:09 schrieb Allen Winter: > Howdy KMail Gurus, > > Attached is a backtrace from a KMail crash that just happened to me. > I'm using a pretty recent version from branch... maybe a week old. > > Not sure what to make of it. Was it a segmentation fault or an abort? In case of a segmentation fault=20 my only guess is that the progress item might have been destroyed too=20 early. Related bug reports: http://bugs.kde.org/show_bug.cgi?id=3D110487 http://bugs.kde.org/show_bug.cgi?id=3D118112 http://bugs.kde.org/show_bug.cgi?id=3D119112 http://bugs.kde.org/show_bug.cgi?id=3D121384 http://bugs.kde.org/show_bug.cgi?id=3D127210 I think I know what might happen: A check for new mail starts. The check takes some time. The next check=20 is started, but since we are already checking=20 PopAccount::processNewMail() calls KMAccount::checkDone( false, CheckIgnored ) which calls mMailCheckProgressItem->setComplete() and then sets mMailCheckProgressItem =3D 0. Now I guess that setComplete() doesn't return fast enough so that PopAccount::slotJobFinished() is invoked because the 1st check just=20 finished and this checks for mMailCheckProgressItem =3D=3D 0. If it's not 0= =20 then it uses the progress item and this eventually leads to the crash. Hmm, doesn't seem to be right. As soon as a check is started the timer=20 is stopped. So another check can't start (at least not a timer invoked=20 one and the bug reports clearly indicate that the users didn't do a=20 manual check). Maybe slotFinished() is invoked twice for some reason? Attached is the patch I'm going to commit when I'm home again. Regards, Ingo --Boundary-01=_wRNpEspg/7i+Gcs Content-Type: text/x-diff; charset="iso-8859-15"; name="fix-popaccount-crashes.diff" Content-Transfer-Encoding: quoted-printable Content-Disposition: attachment; filename="fix-popaccount-crashes.diff" Index: kmaccount.cpp =3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D= =3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D= =3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D =2D-- kmaccount.cpp (Revision 556419) +++ kmaccount.cpp (Arbeitskopie) @@ -444,8 +444,11 @@ void KMAccount::checkDone( bool newmail, if (mTimer) mTimer->start(mInterval*60000); if ( mMailCheckProgressItem ) { =2D mMailCheckProgressItem->setComplete(); // that will delete it + // set mMailCheckProgressItem =3D 0 before calling setComplete() to pr= event + // a race condition + ProgressItem *savedMailCheckProgressItem =3D mMailCheckProgressItem; mMailCheckProgressItem =3D 0; + savedMailCheckProgressItem->setComplete(); // that will delete it } =20 emit newMailsProcessed( mNewInFolder ); Index: popaccount.cpp =3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D= =3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D= =3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D =2D-- popaccount.cpp (Revision 556419) +++ popaccount.cpp (Arbeitskopie) @@ -348,8 +348,9 @@ void PopAccount::slotProcessPendingMsgs( void PopAccount::slotAbortRequested() { if (stage =3D=3D Idle) return; =2D disconnect( mMailCheckProgressItem, SIGNAL( progressItemCanceled( KPIM= ::ProgressItem* ) ), =2D this, SLOT( slotAbortRequested() ) ); + if ( mMailCheckProgressItem ) + disconnect( mMailCheckProgressItem, SIGNAL( progressItemCanceled( KPIM= ::ProgressItem* ) ), + this, SLOT( slotAbortRequested() ) ); stage =3D Quit; if (job) job->kill(); job =3D 0; @@ -655,7 +656,8 @@ void PopAccount::slotJobFinished() { processMsgsTimer.start(processingDelay); } else if (stage =3D=3D Retr) { =2D mMailCheckProgressItem->setProgress( 100 ); + if ( mMailCheckProgressItem ) + mMailCheckProgressItem->setProgress( 100 ); processRemainingQueuedMessages(); =20 mHeaderDeleteUids.clear(); @@ -732,20 +734,22 @@ void PopAccount::slotJobFinished() { // If there are messages to delete then delete them if ( !idsOfMsgsToDelete.isEmpty() ) { stage =3D Dele; =2D mMailCheckProgressItem->setStatus( =2D i18n( "Fetched 1 message from %1. Deleting messages from server.= =2E.", =2D "Fetched %n messages from %1. Deleting messages from serve= r...", =2D numMsgs ) =2D .arg( mHost ) ); + if ( mMailCheckProgressItem ) + mMailCheckProgressItem->setStatus( + i18n( "Fetched 1 message from %1. Deleting messages from server.= =2E.", + "Fetched %n messages from %1. Deleting messages from serve= r...", + numMsgs ) + .arg( mHost ) ); url.setPath("/remove/" + idsOfMsgsToDelete.join(",")); kdDebug(5006) << "url: " << url.prettyURL() << endl; } else { stage =3D Quit; =2D mMailCheckProgressItem->setStatus( =2D i18n( "Fetched 1 message from %1. Terminating transmission...", =2D "Fetched %n messages from %1. Terminating transmission...", =2D numMsgs ) =2D .arg( mHost ) ); + if ( mMailCheckProgressItem ) + mMailCheckProgressItem->setStatus( + i18n( "Fetched 1 message from %1. Terminating transmission...", + "Fetched %n messages from %1. Terminating transmission...", + numMsgs ) + .arg( mHost ) ); url.setPath(QString("/commit")); kdDebug(5006) << "url: " << url.prettyURL() << endl; } @@ -760,11 +764,12 @@ void PopAccount::slotJobFinished() { mUidsOfNextSeenMsgsDict.remove( mUidForIdMap[*it] ); } idsOfMsgsToDelete.clear(); =2D mMailCheckProgressItem->setStatus( =2D i18n( "Fetched 1 message from %1. Terminating transmission...", =2D "Fetched %n messages from %1. Terminating transmission...", =2D numMsgs ) =2D .arg( mHost ) ); + if ( mMailCheckProgressItem ) + mMailCheckProgressItem->setStatus( + i18n( "Fetched 1 message from %1. Terminating transmission...", + "Fetched %n messages from %1. Terminating transmission...", + numMsgs ) + .arg( mHost ) ); KURL url =3D getUrl(); url.setPath(QString("/commit")); job =3D KIO::get( url, false, false ); @@ -783,8 +788,11 @@ void PopAccount::slotJobFinished() { int numMessages =3D canceled ? indexOfCurrentMsg : idsOfMsgs.count(); BroadcastStatus::instance()->setStatusMsgTransmissionCompleted( this->name(), numMessages, numBytes, numBytesRead, numBytesToRead,= mLeaveOnServer, mMailCheckProgressItem ); =2D mMailCheckProgressItem->setComplete(); + // set mMailCheckProgressItem =3D 0 before calling setComplete() to = prevent + // a race condition + ProgressItem *savedMailCheckProgressItem =3D mMailCheckProgressItem; mMailCheckProgressItem =3D 0; + savedMailCheckProgressItem->setComplete(); // that will delete it checkDone( ( numMessages > 0 ), canceled ? CheckAborted : CheckOK ); } } @@ -873,7 +881,9 @@ void PopAccount::slotData( KIO::Job* job numMsgBytesRead =3D curMsgLen; numBytesRead +=3D numMsgBytesRead - oldNumMsgBytesRead; dataCounter++; =2D if (dataCounter % 5 =3D=3D 0) + if ( mMailCheckProgressItem && + ( dataCounter % 5 =3D=3D 0 || + ( indexOfCurrentMsg + 1 =3D=3D numMsgs && numMsgBytesRead =3D= =3D curMsgLen ) ) ) { QString msg; if (numBytes !=3D numBytesToRead && mLeaveOnServer) --Boundary-01=_wRNpEspg/7i+Gcs-- --nextPart3292617.3cIELq0SVj Content-Type: application/pgp-signature -----BEGIN PGP SIGNATURE----- Version: GnuPG v1.4.0 (GNU/Linux) iD8DBQBEpNSMqUQWN/hplRsRAi+AAJ0SzroAAccgrQcTkB3KU2T0vegasgCeOgxw C3DYnO8Xgjm9xHFd28/4N0I= =+E89 -----END PGP SIGNATURE----- --nextPart3292617.3cIELq0SVj-- --===============1659843432== Content-Type: text/plain; charset="us-ascii" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit Content-Disposition: inline _______________________________________________ KMail developers mailing list KMail-devel@kde.org https://mail.kde.org/mailman/listinfo/kmail-devel --===============1659843432==--