[Kde-pim] [patch] kdepimlibs/kabc: fix crash appearing at qDeleteAll ()

Jaroslaw Staniek js at iidea.pl
Wed Jun 18 20:21:27 BST 2008


Ingo Klöcker said the following, On 2008-06-18 20:50:
> 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:

This is not the only cost.
removeDistributionList() and mDistListMap.find() is also called for every 
item. Please look at the new patch -is that ok? :

void Resource::removeDistributionList( DistributionList *list ) {
	if ( mDistListMap.isEmpty() )
		return;
[..]

-- 
regards / pozdrawiam, Jaroslaw Staniek
  Sponsored by OpenOffice Polska (http://www.openoffice.com.pl/en) to work on
  Kexi & KOffice (http://www.kexi.pl/en, http://www.koffice.org/kexi)
  KDE Libraries for MS Windows (http://windows.kde.org)
-------------- next part --------------
An embedded and charset-unspecified text was scrubbed...
Name: kabc_resource2.patch
URL: <http://mail.kde.org/pipermail/kde-pim/attachments/20080618/e7277649/attachment.ksh>
-------------- next part --------------
_______________________________________________
KDE PIM mailing list kde-pim at kde.org
https://mail.kde.org/mailman/listinfo/kde-pim
KDE PIM home page at http://pim.kde.org/


More information about the kde-pim mailing list