[prev in list] [next in list] [prev in thread] [next in thread] 

List:       kmail-devel
Subject:    Re: Reason for crashes when filtering mails
From:       Ingo =?iso-8859-15?q?Kl=F6cker?= <kloecker () kde ! org>
Date:       2007-02-25 22:04:34
Message-ID: 200702252304.50878 () erwin ! ingo-kloecker ! de
[Download RAW message or body]

[Attachment #2 (multipart/signed)]


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 = msgBase->parent()->find(msgBase);
>       assert(idx != -1);
>       KMMessage * msg = msgBase->parent()->getMsg(idx);
>
> If I insert a condition to process only for idx != 0, KMail doesn't
> crash anymore.
> This makes me wonder if idx == 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 
case of mStorage == NULL.

msgBase->parent()->find( msgBase ) >= 0 always has to be true because 
obviously msgBase must be in its parent (i.e. its folder) and thus it 
must be found in the folder. mStorage being NULL is of course a serious 
problem and I have no idea how that could ever happen because mStorage 
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 
crash I suggest adding a check for idx != -1 after the assert and 
disabling the assert in the release build.

It would be great if you could debug this a bit more in order to find 
out why mStorage is NULL.

Regards,
Ingo

[Attachment #5 (application/pgp-signature)]

_______________________________________________
KMail developers mailing list
KMail-devel@kde.org
https://mail.kde.org/mailman/listinfo/kmail-devel


[prev in list] [next in list] [prev in thread] [next in thread] 

Configure | About | News | Add a list | Sponsored by KoreLogic