[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-27 23:10:41
Message-ID: 200702280010.43390 () erwin ! ingo-kloecker ! de
[Download RAW message or body]

[Attachment #2 (multipart/signed)]


On Tuesday 27 February 2007 15:10, Andreas Gungl wrote:
> Am Monday 26 February 2007 schrieb Ingo Klöcker:
> > A really dirty (and probably quick) solution would be not to delete
> > the KMMsgInfo object when a corresponding KMMessage is created, but
> > to remember the pointer to the KMMsgInfo object in the KMMessage
> > object and then, when the KMMessage is destroyed, to reset the
> > pointer in the message list to the pointer to the KMMsgInfo object.
> > This would require changes to (at least):
> > - KMMessage (add member variable and getter/setter for KMMsgInfo*)
> > - KMMsgInfo* KMFolderIndex::setIndexEntry( int idx, KMMessage *msg
> > ) (which replaces a KMMessage by the corresponding KMMsgInfo) -
> > KMMessage* KMFolderMaildir::readMsg(int idx)
> > - KMMessage* KMFolderMbox::readMsg(int idx)
> >     (which replaces a KMMsgInfo by the corresponding KMMessage)
> > - void KMMsgList::set(unsigned int idx, KMMsgBase* aMsg)
> >     (which actually deletes the KMMsgInfo/KMMessage objects; FWIW
> > it's really shocking that the documentation of this method reads
> > "[...] If there is already a message at the given index this
> > message is *not* deleted. [...]"; this is obviously a lie :-( )
> >
> > The attached patch contains all those required changes. I didn't
> > even check whether this patch compiles, so please use it with care.
>
> I've given the patch a very quick test and the crashes don't occur
> anymore. I do some more tests tonight at home.
>
> Given that this patch fixes the 3.5 branch, should it be commited? I
> understand that this is no solution for KDE 4, however it would be
> good to get the 3.5 branch working. And somehow I think this change
> might fix some other curious crashes as well.

When I woke up this morning I realized that my patch is really quick & 
dirty with emphasis on dirty. The problem is that if some piece of code 
works with the KMMsgInfo object and another piece of code works with 
the corresponding KMMessage object and now in either of the two objects 
the parent changes then we are in deep trouble. Other dangerous member 
variables of KMMsgBase include mIndexOffset and mIndexLength. An 
inconsistency in those values will easily destroy the index of a 
folder. So my patch isn't such a clever solution and I'm more than a 
bit concerned about committing my patch. I think there's no way around 
hiding the ugliness of KMMsgBase/KMMsgInfo/KMMessage inside a proxy 
object. (Hmm, maybe if KMMsgInfo also get's a pointer to the 
corresponding KMMessage object and the setters of the MsgBase's member 
variables would also call the setters of the corresponding 
MsgInfo/Message instance? I'll see whether I can cook something up this 
weekend.)

> Last but not least, thanks for having a look at this, Ingo. Your
> knowledge of KMail is invaluable.

It's the least I can do.

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