From kde-commits Fri Aug 31 23:14:52 2007 From: Oliver Kellogg Date: Fri, 31 Aug 2007 23:14:52 +0000 To: kde-commits Subject: KDE/kdesdk/umbrello Message-Id: <1188602092.785931.12015.nullmailer () svn ! kde ! org> X-MARC-Message: https://marc.info/?l=kde-commits&m=118860210412490 SVN commit 707073 by okellogg: removeAllAssociationEnds(): I tried different iteration schemes (e.g. using UMLObjectListIt or UMLObjectList::iterator) but the only one that works for me without crashing is this here, using the integer index and QList::removeAt(). BUG:149356 M +2 -1 ChangeLog.2 M +5 -10 umbrello/umlcanvasobject.cpp --- trunk/KDE/kdesdk/umbrello/ChangeLog.2 #707072:707073 @@ -15,7 +15,7 @@ * Found / Lost Messages. - Sequence Diagram * Pre/Post conditions. - * ‘accept time event’ symbol. + * "accept time event" symbol. * Control Flow. * Object Flow. * interruptible region. @@ -31,4 +31,5 @@ * RMB LogicalView->New->Class in treeview creates TWO classes (144537) * New code generator for D language * Add option for automatic drawing attribute associations in class diagram (147061) +* Crash on exit after loading phonon design.xmi (149356) * Crash on saving phonon design.xmi with Advanced Code Generators enabled (149357) --- trunk/KDE/kdesdk/umbrello/umbrello/umlcanvasobject.cpp #707072:707073 @@ -98,16 +98,11 @@ } void UMLCanvasObject::removeAllAssociationEnds() { - UMLObject *o = NULL; - for (UMLObjectListIt oit(m_List); oit.hasNext(); ) { - o = oit.next(); + for (int i = 0; i < m_List.count(); ) { + UMLObject *o = m_List.at(i); if (o->getBaseType() != Uml::ot_Association) { - if ( oit.hasNext() ) { - o = oit.next(); - continue; - } else { - break; - } + ++i; + continue; } UMLAssociation *assoc = static_cast(o); //umldoc->slotRemoveUMLObject(assoc); @@ -133,7 +128,7 @@ else kDebug() << "UMLCanvasObject::removeAllAssociations(" << m_Name << "): objB is NULL" << endl; - m_List.remove(assoc); + m_List.removeAt(i); } }