From kmail-devel Tue Feb 27 23:10:41 2007 From: Ingo =?iso-8859-15?q?Kl=F6cker?= Date: Tue, 27 Feb 2007 23:10:41 +0000 To: kmail-devel Subject: Re: Reason for crashes when filtering mails Message-Id: <200702280010.43390 () erwin ! ingo-kloecker ! de> X-MARC-Message: https://marc.info/?l=kmail-devel&m=117261789025737 MIME-Version: 1 Content-Type: multipart/mixed; boundary="--===============1346529567==" --===============1346529567== Content-type: multipart/signed; boundary=nextPart1713297.gK3Uejg2Sm; protocol="application/pgp-signature"; micalg=pgp-sha1 Content-transfer-encoding: 7bit --nextPart1713297.gK3Uejg2Sm Content-Type: text/plain; charset="iso-8859-15" Content-Transfer-Encoding: quoted-printable Content-Disposition: inline On Tuesday 27 February 2007 15:10, Andreas Gungl wrote: > Am Monday 26 February 2007 schrieb Ingo Kl=F6cker: > > 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) > > =A0 =A0 (which replaces a KMMsgInfo by the corresponding KMMessage) > > - void KMMsgList::set(unsigned int idx, KMMsgBase* aMsg) > > =A0 =A0 (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 &=20 dirty with emphasis on dirty. The problem is that if some piece of code=20 works with the KMMsgInfo object and another piece of code works with=20 the corresponding KMMessage object and now in either of the two objects=20 the parent changes then we are in deep trouble. Other dangerous member=20 variables of KMMsgBase include mIndexOffset and mIndexLength. An=20 inconsistency in those values will easily destroy the index of a=20 folder. So my patch isn't such a clever solution and I'm more than a=20 bit concerned about committing my patch. I think there's no way around=20 hiding the ugliness of KMMsgBase/KMMsgInfo/KMMessage inside a proxy=20 object. (Hmm, maybe if KMMsgInfo also get's a pointer to the=20 corresponding KMMessage object and the setters of the MsgBase's member=20 variables would also call the setters of the corresponding=20 MsgInfo/Message instance? I'll see whether I can cook something up this=20 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 --nextPart1713297.gK3Uejg2Sm Content-Type: application/pgp-signature -----BEGIN PGP SIGNATURE----- Version: GnuPG v1.4.2 (GNU/Linux) iD8DBQBF5LpzGnR+RTDgudgRAl42AJ9U9IvP41yQ6mbdTQG5k2yenqxpKACg5F7B weOfm27uH4++b9CXoIM1krk= =jJHo -----END PGP SIGNATURE----- --nextPart1713297.gK3Uejg2Sm-- --===============1346529567== 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 --===============1346529567==--