summaryrefslogtreecommitdiff
path: root/libopie
authorzecke <zecke>2003-05-07 16:01:45 (UTC)
committer zecke <zecke>2003-05-07 16:01:45 (UTC)
commitef9b40f99443fabed972d29ce47c2ccb29e77210 (patch) (unidiff)
tree920e5b1c5807ca931e86425092d13429029ebe65 /libopie
parentfd0b11fbfe36e87845df9282bb4ed090c7f51d35 (diff)
downloadopie-ef9b40f99443fabed972d29ce47c2ccb29e77210.zip
opie-ef9b40f99443fabed972d29ce47c2ccb29e77210.tar.gz
opie-ef9b40f99443fabed972d29ce47c2ccb29e77210.tar.bz2
Prevent mem corruption
Diffstat (limited to 'libopie') (more/less context) (ignore whitespace changes)
-rw-r--r--libopie/pim/oevent.cpp14
1 files changed, 10 insertions, 4 deletions
diff --git a/libopie/pim/oevent.cpp b/libopie/pim/oevent.cpp
index 56ea10d..3ba8a52 100644
--- a/libopie/pim/oevent.cpp
+++ b/libopie/pim/oevent.cpp
@@ -213,77 +213,83 @@ QString OEvent::timeZone()const {
213bool OEvent::match( const QRegExp& )const { 213bool OEvent::match( const QRegExp& )const {
214 // FIXME 214 // FIXME
215 return false; 215 return false;
216} 216}
217QString OEvent::toRichText()const { 217QString OEvent::toRichText()const {
218 // FIXME 218 // FIXME
219 return "OEvent test"; 219 return "OEvent test";
220} 220}
221QString OEvent::toShortText()const { 221QString OEvent::toShortText()const {
222 return "OEvent shotText"; 222 return "OEvent shotText";
223} 223}
224QString OEvent::type()const { 224QString OEvent::type()const {
225 return QString::fromLatin1("OEvent"); 225 return QString::fromLatin1("OEvent");
226} 226}
227QString OEvent::recordField( int /*id */ )const { 227QString OEvent::recordField( int /*id */ )const {
228 return QString::null; 228 return QString::null;
229} 229}
230int OEvent::rtti() { 230int OEvent::rtti() {
231 return OPimResolver::DateBook; 231 return OPimResolver::DateBook;
232} 232}
233bool OEvent::loadFromStream( QDataStream& ) { 233bool OEvent::loadFromStream( QDataStream& ) {
234 return true; 234 return true;
235} 235}
236bool OEvent::saveToStream( QDataStream& )const { 236bool OEvent::saveToStream( QDataStream& )const {
237 return true; 237 return true;
238} 238}
239void OEvent::changeOrModify() { 239void OEvent::changeOrModify() {
240 if ( data->count != 1 ) { 240 if ( data->count != 1 ) {
241 data->deref(); 241 data->deref();
242 Data* d2 = new Data; 242 Data* d2 = new Data;
243 d2->description = data->description; 243 d2->description = data->description;
244 d2->location = data->location; 244 d2->location = data->location;
245 d2->manager = data->manager; 245
246 d2->recur = data->recur; 246 if (data->manager )
247 d2->manager = new OPimNotifyManager( *data->manager );
248
249 if ( data->recur )
250 d2->recur = new ORecur( *data->recur );
251
247 d2->note = data->note; 252 d2->note = data->note;
248 d2->created = data->created; 253 d2->created = data->created;
249 d2->start = data->start; 254 d2->start = data->start;
250 d2->end = data->end; 255 d2->end = data->end;
251 d2->isAllDay = data->isAllDay; 256 d2->isAllDay = data->isAllDay;
252 d2->timezone = data->timezone; 257 d2->timezone = data->timezone;
253 d2->parent = data->parent; 258 d2->parent = data->parent;
254 d2->child = data->child;
255 259
256 if (d2->child ) 260 if ( data->child ) {
261 d2->child = new QArray<int>( *data->child );
257 d2->child->detach(); 262 d2->child->detach();
263 }
258 264
259 data = d2; 265 data = d2;
260 } 266 }
261} 267}
262void OEvent::deref() { 268void OEvent::deref() {
263 if ( data->deref() ) { 269 if ( data->deref() ) {
264 delete data; 270 delete data;
265 data = 0; 271 data = 0;
266 } 272 }
267} 273}
268// FIXME 274// FIXME
269QMap<int, QString> OEvent::toMap()const { 275QMap<int, QString> OEvent::toMap()const {
270 return QMap<int, QString>(); 276 return QMap<int, QString>();
271} 277}
272QMap<QString, QString> OEvent::toExtraMap()const { 278QMap<QString, QString> OEvent::toExtraMap()const {
273 return QMap<QString, QString>(); 279 return QMap<QString, QString>();
274} 280}
275int OEvent::parent()const { 281int OEvent::parent()const {
276 return data->parent; 282 return data->parent;
277} 283}
278void OEvent::setParent( int uid ) { 284void OEvent::setParent( int uid ) {
279 changeOrModify(); 285 changeOrModify();
280 data->parent = uid; 286 data->parent = uid;
281} 287}
282QArray<int> OEvent::children() const{ 288QArray<int> OEvent::children() const{
283 if (!data->child) return QArray<int>(); 289 if (!data->child) return QArray<int>();
284 else 290 else
285 return data->child->copy(); 291 return data->child->copy();
286} 292}
287void OEvent::setChildren( const QArray<int>& arr ) { 293void OEvent::setChildren( const QArray<int>& arr ) {
288 changeOrModify(); 294 changeOrModify();
289 if (data->child) delete data->child; 295 if (data->child) delete data->child;