author | ulf69 <ulf69> | 2004-08-19 23:29:05 (UTC) |
---|---|---|
committer | ulf69 <ulf69> | 2004-08-19 23:29:05 (UTC) |
commit | d81fbb0a720ba6eb0fbfa1d1eb0748877237a27e (patch) (unidiff) | |
tree | 9b723a5c4f7da306036495e35d1863fbee646984 | |
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/ContentLine.cpp | 31 | ||||
-rw-r--r-- | kabc/vcard/VCardEntity.cpp | 3 | ||||
-rw-r--r-- | kabc/vcard/VCardv.cpp | 23 |
3 files changed, 51 insertions, 6 deletions
diff --git a/kabc/vcard/ContentLine.cpp b/kabc/vcard/ContentLine.cpp index 6fa1a8f..0fb5b5d 100644 --- a/kabc/vcard/ContentLine.cpp +++ b/kabc/vcard/ContentLine.cpp | |||
@@ -65,35 +65,60 @@ | |||
65 | using namespace VCARD; | 65 | using namespace VCARD; |
66 | 66 | ||
67 | ContentLine::ContentLine() | 67 | ContentLine::ContentLine() |
68 | :Entity(), | 68 | :Entity(), |
69 | value_(0) | 69 | value_(0) |
70 | { | 70 | { |
71 | paramList_.setAutoDelete( TRUE ); | ||
71 | } | 72 | } |
72 | 73 | ||
73 | ContentLine::ContentLine(const ContentLine & x) | 74 | ContentLine::ContentLine(const ContentLine & x) |
74 | :Entity(x), | 75 | :Entity(x), |
75 | group_ (x.group_), | 76 | group_ (x.group_), |
76 | name_ (x.name_), | 77 | name_ (x.name_), |
77 | paramList_(x.paramList_), | 78 | /*US paramList_(x.paramList_),*/ |
78 | value_(x.value_->clone()) | 79 | value_(x.value_->clone()), |
80 | paramType_(x.paramType_), | ||
81 | valueType_(x.valueType_), | ||
82 | entityType_(x.entityType_) | ||
79 | { | 83 | { |
84 | paramList_.setAutoDelete( TRUE ); | ||
85 | |||
86 | |||
87 | ParamListIterator it(x.paramList_); | ||
88 | for (; it.current(); ++it) | ||
89 | { | ||
90 | Param *p = new Param; | ||
91 | p->setName( it.current()->name() ); | ||
92 | p->setValue( it.current()->value() ); | ||
93 | paramList_.append(p); | ||
94 | } | ||
95 | |||
80 | } | 96 | } |
81 | 97 | ||
82 | ContentLine::ContentLine(const QCString & s) | 98 | ContentLine::ContentLine(const QCString & s) |
83 | :Entity(s), | 99 | :Entity(s), |
84 | value_(0) | 100 | value_(0) |
85 | { | 101 | { |
102 | paramList_.setAutoDelete( TRUE ); | ||
86 | } | 103 | } |
87 | 104 | ||
88 | ContentLine & | 105 | ContentLine & |
89 | ContentLine::operator = (ContentLine & x) | 106 | ContentLine::operator = (ContentLine & x) |
90 | { | 107 | { |
91 | if (*this == x) return *this; | 108 | if (*this == x) return *this; |
92 | 109 | ||
93 | paramList_ = x.paramList(); | 110 | ParamListIterator it(x.paramList_); |
111 | for (; it.current(); ++it) | ||
112 | { | ||
113 | Param *p = new Param; | ||
114 | p->setName( it.current()->name() ); | ||
115 | p->setValue( it.current()->value() ); | ||
116 | paramList_.append(p); | ||
117 | } | ||
118 | |||
94 | value_ = x.value_->clone(); | 119 | value_ = x.value_->clone(); |
95 | 120 | ||
96 | Entity::operator = (x); | 121 | Entity::operator = (x); |
97 | return *this; | 122 | return *this; |
98 | } | 123 | } |
99 | 124 | ||
diff --git a/kabc/vcard/VCardEntity.cpp b/kabc/vcard/VCardEntity.cpp index 0c21e2f..0cd2086 100644 --- a/kabc/vcard/VCardEntity.cpp +++ b/kabc/vcard/VCardEntity.cpp | |||
@@ -28,22 +28,25 @@ | |||
28 | 28 | ||
29 | using namespace VCARD; | 29 | using namespace VCARD; |
30 | 30 | ||
31 | VCardEntity::VCardEntity() | 31 | VCardEntity::VCardEntity() |
32 | :Entity() | 32 | :Entity() |
33 | { | 33 | { |
34 | cardList_.setAutoDelete( TRUE ); | ||
34 | } | 35 | } |
35 | 36 | ||
36 | VCardEntity::VCardEntity(const VCardEntity & x) | 37 | VCardEntity::VCardEntity(const VCardEntity & x) |
37 | :Entity(x) | 38 | :Entity(x) |
38 | { | 39 | { |
40 | cardList_.setAutoDelete( TRUE ); | ||
39 | } | 41 | } |
40 | 42 | ||
41 | VCardEntity::VCardEntity(const QCString & s) | 43 | VCardEntity::VCardEntity(const QCString & s) |
42 | :Entity(s) | 44 | :Entity(s) |
43 | { | 45 | { |
46 | cardList_.setAutoDelete( TRUE ); | ||
44 | } | 47 | } |
45 | 48 | ||
46 | VCardEntity & | 49 | VCardEntity & |
47 | VCardEntity::operator = (VCardEntity & x) | 50 | VCardEntity::operator = (VCardEntity & x) |
48 | { | 51 | { |
49 | if (*this == x) return *this; | 52 | if (*this == x) return *this; |
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 | |||
@@ -33,33 +33,50 @@ | |||
33 | 33 | ||
34 | using namespace VCARD; | 34 | using namespace VCARD; |
35 | 35 | ||
36 | VCard::VCard() | 36 | VCard::VCard() |
37 | :Entity() | 37 | :Entity() |
38 | { | 38 | { |
39 | contentLineList_.setAutoDelete( TRUE ); | ||
39 | } | 40 | } |
40 | 41 | ||
41 | VCard::VCard(const VCard & x) | 42 | VCard::VCard(const VCard & x) |
42 | :Entity(x), | 43 | :Entity(x), |
43 | group_(x.group_), | 44 | group_(x.group_) |
44 | contentLineList_(x.contentLineList_) | ||
45 | { | 45 | { |
46 | contentLineList_.setAutoDelete( TRUE ); | ||
47 | //US | ||
48 | qDebug("VCard::VCard"); | ||
49 | |||
50 | QPtrListIterator<ContentLine> it(x.contentLineList_); | ||
51 | for (; it.current(); ++it) { | ||
52 | ContentLine * c = new ContentLine(*it.current()); | ||
53 | contentLineList_.append(c); | ||
54 | } | ||
55 | |||
46 | } | 56 | } |
47 | 57 | ||
48 | VCard::VCard(const QCString & s) | 58 | VCard::VCard(const QCString & s) |
49 | :Entity(s) | 59 | :Entity(s) |
50 | { | 60 | { |
61 | contentLineList_.setAutoDelete( TRUE ); | ||
51 | } | 62 | } |
52 | 63 | ||
53 | VCard & | 64 | VCard & |
54 | VCard::operator = (VCard & x) | 65 | VCard::operator = (VCard & x) |
55 | { | 66 | { |
67 | //US | ||
68 | qDebug("VCard::operator ="); | ||
56 | if (*this == x) return *this; | 69 | if (*this == x) return *this; |
57 | 70 | ||
58 | group_ = x.group(); | 71 | group_ = x.group(); |
59 | contentLineList_= x.contentLineList_; | 72 | QPtrListIterator<ContentLine> it(x.contentLineList_); |
73 | for (; it.current(); ++it) { | ||
74 | ContentLine * c = new ContentLine(*it.current()); | ||
75 | contentLineList_.append(c); | ||
76 | } | ||
60 | 77 | ||
61 | Entity::operator = (x); | 78 | Entity::operator = (x); |
62 | return *this; | 79 | return *this; |
63 | } | 80 | } |
64 | 81 | ||
65 | VCard & | 82 | VCard & |