Commit 9a8a58ad authored by Ralf Habacker's avatar Ralf Habacker

Remove zero pointers in UMLCanvasObject::m_List on access.

parent ec44b8bc
......@@ -432,7 +432,6 @@ UMLAttributeList UMLClassifier::getAttributeList() const
{
UMLAttributeList attributeList;
foreach (UMLObject* listItem, subordinates()) {
uIgnoreZeroPointer(listItem);
if (listItem->baseType() == UMLObject::ot_Attribute) {
attributeList.append(listItem->asUMLAttribute());
}
......@@ -520,7 +519,6 @@ UMLOperationList UMLClassifier::findOperations(const QString &n)
const bool caseSensitive = UMLApp::app()->activeLanguageIsCaseSensitive();
UMLOperationList list;
foreach (UMLObject* obj, subordinates()) {
uIgnoreZeroPointer(obj);
if (obj->baseType() != UMLObject::ot_Operation)
continue;
UMLOperation *op = obj->asUMLOperation();
......@@ -652,7 +650,6 @@ void UMLClassifier::copyInto(UMLObject *lhs) const
// CHECK: association property m_pClassAssoc is not copied
subordinates().copyInto(&(target->subordinates()));
foreach(UMLObject *o, target->subordinates()) {
uIgnoreZeroPointer(o);
o->setUMLParent(target);
}
}
......@@ -680,7 +677,6 @@ bool UMLClassifier::resolveRef()
bool success = UMLPackage::resolveRef();
// Using reentrant iteration is a bare necessity here:
foreach (UMLObject* obj, subordinates()) {
uIgnoreZeroPointer(obj);
/**** For reference, here is the non-reentrant iteration scheme -
DO NOT USE THIS !
for (UMLObject *obj = subordinates().first(); obj; obj = subordinates().next())
......
......@@ -64,7 +64,6 @@ UMLAssociationList UMLCanvasObject::getSpecificAssocs(Uml::AssociationType::Enum
UMLObject *o = 0;
for (UMLObjectListIt oit(subordinates()); oit.hasNext();) {
o = oit.next();
uIgnoreZeroPointer(o);
if (o->baseType() != UMLObject::ot_Association)
continue;
UMLAssociation *a = o->asUMLAssociation();
......@@ -133,7 +132,6 @@ void UMLCanvasObject::removeAllAssociationEnds()
{
for (int i = 0; i < subordinates().count(); i++) {
UMLObject *o = subordinates().at(i);
uIgnoreZeroPointer(o);
if (o->baseType() != UMLObject::ot_Association) {
continue;
}
......@@ -246,7 +244,6 @@ UMLObject * UMLCanvasObject::findChildObject(const QString &n, UMLObject::Object
UMLObject *obj = 0;
for (UMLObjectListIt oit(subordinates()); oit.hasNext();) {
obj = oit.next();
uIgnoreZeroPointer(obj);
if (t != UMLObject::ot_UMLObject && obj->baseType() != t)
continue;
if (caseSensitive) {
......@@ -272,7 +269,6 @@ UMLObject* UMLCanvasObject::findChildObjectById(Uml::ID::Type id, bool considerA
UMLObject *o = 0;
for (UMLObjectListIt oit(subordinates()); oit.hasNext();) {
o = oit.next();
uIgnoreZeroPointer(o);
if (o->id() == id)
return o;
}
......@@ -325,7 +321,6 @@ int UMLCanvasObject::associations()
UMLObject *obj = 0;
for (UMLObjectListIt oit(subordinates()); oit.hasNext();) {
obj = oit.next();
uIgnoreZeroPointer(obj);
if (obj->baseType() == UMLObject::ot_Association)
count++;
}
......@@ -343,7 +338,6 @@ UMLAssociationList UMLCanvasObject::getAssociations()
UMLObject *o = 0;
for (UMLObjectListIt oit(subordinates()); oit.hasNext() ;) {
o = oit.next();
uIgnoreZeroPointer(o);
if (o->baseType() != UMLObject::ot_Association)
continue;
UMLAssociation *assoc = o->asUMLAssociation();
......@@ -456,7 +450,6 @@ bool UMLCanvasObject::resolveRef()
bool overallSuccess = UMLObject::resolveRef();
for (UMLObjectListIt ait(subordinates()); ait.hasNext();) {
UMLObject *obj = ait.next();
uIgnoreZeroPointer(obj);
if (! obj->resolveRef()) {
subordinates().removeAll(obj);
overallSuccess = false;
......
......@@ -78,6 +78,7 @@ public:
virtual void removeAllChildObjects();
UMLObjectList &subordinates() const {
m_List.removeAll(0);
return m_List;
}
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment