author | ulf69 <ulf69> | 2004-08-19 23:29:05 (UTC) |
---|---|---|
committer | ulf69 <ulf69> | 2004-08-19 23:29:05 (UTC) |
commit | d81fbb0a720ba6eb0fbfa1d1eb0748877237a27e (patch) (side-by-side diff) | |
tree | 9b723a5c4f7da306036495e35d1863fbee646984 /kabc/vcard/VCardv.cpp | |
parent | d9b7a7296b031b3cf3e510a163367b9c4ab42d7a (diff) | |
download | kdepimpi-d81fbb0a720ba6eb0fbfa1d1eb0748877237a27e.zip kdepimpi-d81fbb0a720ba6eb0fbfa1d1eb0748877237a27e.tar.gz kdepimpi-d81fbb0a720ba6eb0fbfa1d1eb0748877237a27e.tar.bz2 |
bugfix: memoryleak in vCards during loading of addressbooks
-rw-r--r-- | kabc/vcard/VCardv.cpp | 23 |
1 files changed, 20 insertions, 3 deletions
diff --git a/kabc/vcard/VCardv.cpp b/kabc/vcard/VCardv.cpp index 8d271f4..3f0a5e5 100644 --- a/kabc/vcard/VCardv.cpp +++ b/kabc/vcard/VCardv.cpp @@ -36,27 +36,44 @@ using namespace VCARD; VCard::VCard() : Entity() { + contentLineList_.setAutoDelete( TRUE ); } VCard::VCard(const VCard & x) : Entity(x), - group_(x.group_), - contentLineList_(x.contentLineList_) + group_(x.group_) { + contentLineList_.setAutoDelete( TRUE ); + //US + qDebug("VCard::VCard"); + + QPtrListIterator<ContentLine> it(x.contentLineList_); + for (; it.current(); ++it) { + ContentLine * c = new ContentLine(*it.current()); + contentLineList_.append(c); + } + } VCard::VCard(const QCString & s) : Entity(s) { + contentLineList_.setAutoDelete( TRUE ); } VCard & VCard::operator = (VCard & x) { + //US + qDebug("VCard::operator ="); if (*this == x) return *this; group_ = x.group(); - contentLineList_ = x.contentLineList_; + QPtrListIterator<ContentLine> it(x.contentLineList_); + for (; it.current(); ++it) { + ContentLine * c = new ContentLine(*it.current()); + contentLineList_.append(c); + } Entity::operator = (x); return *this; |