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

List:       kde-pim
Subject:    Re: [Kde-pim]
From:       Ingo =?iso-8859-15?q?Kl=F6cker?= <kloecker () kde ! org>
Date:       2008-06-18 18:50:25
Message-ID: 200806182050.42130 () erwin ! ingo-kloecker ! de
[Download RAW message or body]

[Attachment #2 (multipart/signed)]


On Wednesday 18 June 2008, Jaroslaw Staniek wrote:
> (for review; enterprise4 branch)
>
> - Resource::clear() fix crash appearing at qDeleteAll(mDistListMap)
> beacuse DistributionList objects' destructor calls
>    Resource::removeDistributionList(), which in turn modifies with
>    mDistListMap. We are now blocking removeDistributionList() when
> qDeleteAll() is called.
>    Instead of erasing() every deleted item from the map, we're
> calling QMap::clear() afterwards.
>
> - simplify code related to mDistListMap: use Qt4 facilities and some
>    more constness

I propose the following solution that avoids adding a member variable at 
the cost of copying mDistListMap:
=====
@@ -350,7 +353,10 @@
 {
   mAddrMap.clear();
 
+  // take a copy of mDistListMap, then clear it and finally qDeleteAll
+  // the copy to avoid problems with removeDistributionList() called by
+  // ~DistributionList().
+  DistributionListMap tempDistListMap( mDistListMap );
+  mDistListMap.clear();
+   qDeleteAll( tempDistListMap );
 -  qDeleteAll( mDistListMap );
 }
 
 void Resource::insertDistributionList( DistributionList *list )
=====

Note that I haven't checked whether Resource::removeDistributionList( 
DistributionList *list ) plays nice if it does not find list in 
mDistListMap.


Regards,
Ingo

["signature.asc" (application/pgp-signature)]

_______________________________________________
KDE PIM mailing list kde-pim@kde.org
https://mail.kde.org/mailman/listinfo/kde-pim
KDE PIM home page at http://pim.kde.org/

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

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