summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorRalf Habacker <[email protected]>2015-06-22 14:16:49 +0200
committerRalf Habacker <[email protected]>2015-06-22 17:46:06 +0200
commit0d7fa88e6181e09d9ba6a6b3f7d996d31f19343b (patch)
tree9a41b18df03b1061aec4bdb830f5abbbde605475
parent8bd6a11cc45de1e5f610a8f874fd265b60581189 (diff)
Make access to zero pointers in UMLPackage::m_objects visible.
-rw-r--r--umbrello/classifier.cpp1
-rw-r--r--umbrello/component.cpp1
-rw-r--r--umbrello/dialogs/pages/packagecontentspage.cpp1
-rw-r--r--umbrello/folder.cpp5
-rw-r--r--umbrello/model_utils.cpp2
-rw-r--r--umbrello/package.cpp6
-rw-r--r--umbrello/umldoc.cpp2
-rw-r--r--umbrello/umlscene.cpp1
-rw-r--r--umbrello/widgets/componentwidget.cpp1
9 files changed, 20 insertions, 0 deletions
diff --git a/umbrello/classifier.cpp b/umbrello/classifier.cpp
index 2013f6d..b97c2f5 100644
--- a/umbrello/classifier.cpp
+++ b/umbrello/classifier.cpp
@@ -1477,6 +1477,7 @@ void UMLClassifier::saveToXMI(QDomDocument & qDoc, QDomElement & qElement)
if (m_objects.count()) {
QDomElement ownedElement = qDoc.createElement(QLatin1String("UML:Namespace.ownedElement"));
foreach (UMLObject* obj, m_objects) {
+ uIgnoreZeroPointer(obj);
obj->saveToXMI (qDoc, ownedElement);
}
classifierElement.appendChild(ownedElement);
diff --git a/umbrello/component.cpp b/umbrello/component.cpp
index e8a43dd..dccb862 100644
--- a/umbrello/component.cpp
+++ b/umbrello/component.cpp
@@ -62,6 +62,7 @@ void UMLComponent::saveToXMI(QDomDocument& qDoc, QDomElement& qElement)
QDomElement ownedElement = qDoc.createElement(QLatin1String("UML:Namespace.ownedElement"));
for (UMLObjectListIt objectsIt(m_objects); objectsIt.hasNext();) {
UMLObject* obj = objectsIt.next();
+ uIgnoreZeroPointer(obj);
obj->saveToXMI (qDoc, ownedElement);
}
componentElement.appendChild(ownedElement);
diff --git a/umbrello/dialogs/pages/packagecontentspage.cpp b/umbrello/dialogs/pages/packagecontentspage.cpp
index b249d07..5af9ecb 100644
--- a/umbrello/dialogs/pages/packagecontentspage.cpp
+++ b/umbrello/dialogs/pages/packagecontentspage.cpp
@@ -97,6 +97,7 @@ void PackageContentsPage::fillListBox()
UMLObject* umlo = NULL;
while (objList_it.hasNext()) {
umlo = objList_it.next();
+ uIgnoreZeroPointer(umlo);
m_contentLW->addItem(umlo->name());
}
}
diff --git a/umbrello/folder.cpp b/umbrello/folder.cpp
index 23c512a..3da66cd 100644
--- a/umbrello/folder.cpp
+++ b/umbrello/folder.cpp
@@ -107,6 +107,7 @@ void UMLFolder::appendViews(UMLViewList& viewList, bool includeNested)
{
if (includeNested) {
foreach (UMLObject* o, m_objects) {
+ uIgnoreZeroPointer(o);
if (o->baseType() == UMLObject::ot_Folder) {
UMLFolder *f = static_cast<UMLFolder*>(o);
f->appendViews(viewList);
@@ -126,6 +127,7 @@ void UMLFolder::appendViews(UMLViewList& viewList, bool includeNested)
void UMLFolder::activateViews()
{
foreach (UMLObject* o, m_objects) {
+ uIgnoreZeroPointer(o);
if (o->baseType() == UMLObject::ot_Folder) {
UMLFolder *f = static_cast<UMLFolder*>(o);
f->activateViews();
@@ -191,6 +193,7 @@ UMLView *UMLFolder::findView(Uml::DiagramType::Enum type, const QString &name, b
UMLView* v = 0;
if (searchAllScopes) {
foreach (UMLObject* o, m_objects) {
+ uIgnoreZeroPointer(o);
if (o->baseType() != UMLObject::ot_Folder) {
continue;
}
@@ -221,6 +224,7 @@ void UMLFolder::setViewOptions(const Settings::OptionState& optionState)
void UMLFolder::removeAllViews()
{
foreach (UMLObject* o, m_objects) {
+ uIgnoreZeroPointer(o);
if (o->baseType() != UMLObject::ot_Folder)
continue;
UMLFolder *f = static_cast<UMLFolder*>(o);
@@ -269,6 +273,7 @@ void UMLFolder::saveContents(QDomDocument& qDoc, QDomElement& qElement)
// Save contained objects if any.
for (UMLObjectListIt oit(m_objects); oit.hasNext();) {
obj = oit.next();
+ uIgnoreZeroPointer(obj);
obj->saveToXMI (qDoc, ownedElement);
}
// Save asscociations if any.
diff --git a/umbrello/model_utils.cpp b/umbrello/model_utils.cpp
index 48ab628..94b00c8 100644
--- a/umbrello/model_utils.cpp
+++ b/umbrello/model_utils.cpp
@@ -215,6 +215,7 @@ UMLObject* findUMLObject(const UMLObjectList& inList,
UMLObjectList objectsInCurrentScope = pkg->containedObjects();
for (UMLObjectListIt oit(objectsInCurrentScope); oit.hasNext();) {
UMLObject *obj = oit.next();
+ uIgnoreZeroPointer(obj);
if (caseSensitive) {
if (obj->name() != name)
continue;
@@ -261,6 +262,7 @@ UMLObject* findUMLObject(const UMLObjectList& inList,
}
for (UMLObjectListIt oit(inList); oit.hasNext();) {
UMLObject *obj = oit.next();
+ uIgnoreZeroPointer(obj);
if (caseSensitive) {
if (obj->name() != name)
continue;
diff --git a/umbrello/package.cpp b/umbrello/package.cpp
index 8db8de1..6d80aa6 100644
--- a/umbrello/package.cpp
+++ b/umbrello/package.cpp
@@ -291,6 +291,7 @@ void UMLPackage::appendPackages(UMLPackageList& packages, bool includeNested)
{
for (UMLObjectListIt oit(m_objects); oit.hasNext();) {
UMLObject *o = oit.next();
+ uIgnoreZeroPointer(o);
ObjectType ot = o->baseType();
if (ot == ot_Package || ot == ot_Folder) {
packages.append(static_cast<UMLPackage*>(o));
@@ -315,6 +316,7 @@ void UMLPackage::appendClassifiers(UMLClassifierList& classifiers,
{
for (UMLObjectListIt oit(m_objects); oit.hasNext();) {
UMLObject *o = oit.next();
+ uIgnoreZeroPointer(o);
ObjectType ot = o->baseType();
if (ot == ot_Class || ot == ot_Interface ||
ot == ot_Datatype || ot == ot_Enum || ot == ot_Entity) {
@@ -339,6 +341,7 @@ void UMLPackage::appendEntities(UMLEntityList& entities,
{
for (UMLObjectListIt oit(m_objects); oit.hasNext();) {
UMLObject *o = oit.next();
+ uIgnoreZeroPointer(o);
ObjectType ot = o->baseType();
if (ot == ot_Entity) {
UMLEntity *c = static_cast<UMLEntity*>(o);
@@ -363,6 +366,7 @@ void UMLPackage::appendClassesAndInterfaces(UMLClassifierList& classifiers,
{
for (UMLObjectListIt oit(m_objects); oit.hasNext();) {
UMLObject *o = oit.next();
+ uIgnoreZeroPointer(o);
ObjectType ot = o->baseType();
if (ot == ot_Class || ot == ot_Interface) {
UMLClassifier *c = static_cast<UMLClassifier*>(o);
@@ -387,6 +391,7 @@ bool UMLPackage::resolveRef()
bool overallSuccess = UMLCanvasObject::resolveRef();
for (UMLObjectListIt oit(m_objects); oit.hasNext();) {
UMLObject *obj = oit.next();
+ uIgnoreZeroPointer(obj);
if (! obj->resolveRef()) {
UMLObject::ObjectType ot = obj->baseType();
if (ot != UMLObject::ot_Package && ot != UMLObject::ot_Folder)
@@ -408,6 +413,7 @@ void UMLPackage::saveToXMI(QDomDocument& qDoc, QDomElement& qElement)
// save classifiers etc.
for (UMLObjectListIt oit(m_objects); oit.hasNext();) {
obj = oit.next();
+ uIgnoreZeroPointer(obj);
obj->saveToXMI (qDoc, ownedElement);
}
// save associations
diff --git a/umbrello/umldoc.cpp b/umbrello/umldoc.cpp
index 32af8e1..2613243 100644
--- a/umbrello/umldoc.cpp
+++ b/umbrello/umldoc.cpp
@@ -1896,6 +1896,7 @@ void UMLDoc::removeUMLObject(UMLObject* umlobject, bool deleteObject)
// being iterated over.
UMLAssociationList assocsToRemove;
foreach (UMLObject *obj, rootObjects) {
+ uIgnoreZeroPointer(obj);
if (obj->baseType() == UMLObject::ot_Association) {
UMLAssociation *assoc = static_cast<UMLAssociation*>(obj);
if (c->hasAssociation(assoc)) {
@@ -2857,6 +2858,7 @@ UMLClassifierList UMLDoc::datatypes()
UMLObjectList objects = m_datatypeRoot->containedObjects();
UMLClassifierList datatypeList;
foreach (UMLObject *obj, objects) {
+ uIgnoreZeroPointer(obj);
if (obj->baseType() == UMLObject::ot_Datatype) {
datatypeList.append(static_cast<UMLClassifier*>(obj));
}
diff --git a/umbrello/umlscene.cpp b/umbrello/umlscene.cpp
index 1696592..80a25bf 100644
--- a/umbrello/umlscene.cpp
+++ b/umbrello/umlscene.cpp
@@ -2318,6 +2318,7 @@ void UMLScene::createAutoAssociations(UMLWidget * widget)
UMLPackage *umlPkg = static_cast<UMLPackage*>(umlObj);
UMLObjectList lst = umlPkg->containedObjects();
foreach(UMLObject* obj, lst) {
+ uIgnoreZeroPointer(obj);
// if the containedObject has a widget representation on this view then
Uml::ID::Type id = obj->id();
foreach(UMLWidget *w, m_WidgetList) {
diff --git a/umbrello/widgets/componentwidget.cpp b/umbrello/widgets/componentwidget.cpp
index 12f2b84..142dca3 100644
--- a/umbrello/widgets/componentwidget.cpp
+++ b/umbrello/widgets/componentwidget.cpp
@@ -148,6 +148,7 @@ void ComponentWidget::adjustAssocs(qreal dx, qreal dy)
UMLWidget::adjustAssocs(dx, dy);
UMLPackage *comp = static_cast<UMLPackage*>(m_umlObject);
foreach (UMLObject *o, comp->containedObjects()) {
+ uIgnoreZeroPointer(o);
if (o->baseType() != UMLObject::ot_Port)
continue;
UMLWidget *portW = m_scene->widgetOnDiagram(o->id());