--===============0076806159== Content-type: multipart/signed; boundary=nextPart7286028.sMyIoD30YX; protocol="application/pgp-signature"; micalg=pgp-sha1 Content-transfer-encoding: 7bit --nextPart7286028.sMyIoD30YX Content-Type: text/plain; charset="iso-8859-15" Content-Transfer-Encoding: quoted-printable Content-Disposition: inline On Sunday 25 February 2007 13:39, Andreas Gungl wrote: > Hello, > > starting with KMail from KDE 3.5.6 I often get crashes when filtering > many messages in a folder manually (applying all filters). > The problem goes down to the following lines in kmfolder.cpp: > > int KMFolder::find( const KMMsgBase* msg ) const > { > return mStorage ? mStorage->find( msg ) : 0; > } > > I've encountered mStorage being null, so I end up with 0 in the > calling method KMHeaders::applyFiltersOnMsg() (in kmheaders.cpp line > 1378). > > int idx =3D msgBase->parent()->find(msgBase); > assert(idx !=3D -1); > KMMessage * msg =3D msgBase->parent()->getMsg(idx); > > If I insert a condition to process only for idx !=3D 0, KMail doesn't > crash anymore. > This makes me wonder if idx =3D=3D 0 is a valid index and how the assert > is meant to work. Of course, the real problem is mStorage being not > defined, but that's a bit beyond my knowledge of the folder stuff in > KMail. 0 is definitely a valid index, so KMFolder::find() should return -1 in=20 case of mStorage =3D=3D NULL. msgBase->parent()->find( msgBase ) >=3D 0 always has to be true because=20 obviously msgBase must be in its parent (i.e. its folder) and thus it=20 must be found in the folder. mStorage being NULL is of course a serious=20 problem and I have no idea how that could ever happen because mStorage=20 is set in the c'tor of KMFolder and it's never set to 0 anywhere. I'm sorry, but I don't see what could possibly go wrong. To prevent the=20 crash I suggest adding a check for idx !=3D -1 after the assert and=20 disabling the assert in the release build. It would be great if you could debug this a bit more in order to find=20 out why mStorage is NULL. Regards, Ingo --nextPart7286028.sMyIoD30YX Content-Type: application/pgp-signature -----BEGIN PGP SIGNATURE----- Version: GnuPG v1.4.2 (GNU/Linux) iD8DBQBF4ggCGnR+RTDgudgRAhmgAJ9U9ICxYToyuM4IZLOlH61M7ilSswCdFoBg OJ55VkaU0OUND765fKIIfAc= =ML2u -----END PGP SIGNATURE----- --nextPart7286028.sMyIoD30YX-- --===============0076806159== 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 --===============0076806159==--