summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorRalf Habacker <ralf.habacker@freenet.de>2016-11-17 22:13:20 (GMT)
committerRalf Habacker <ralf.habacker@freenet.de>2016-11-17 23:14:05 (GMT)
commitb391fe5d6c004080e4e68c5bafadf74b778f559b (patch)
tree83a6b7b142e0a0c2f9dbf1202348896e65477065
parente56248b52cb70f055b194b6c41bac13ae67172f1 (diff)
Fix 'Umbrello crashes after undoing class attribute deletion'.v16.11.80
UMLClassifierListItem objects were not be added to the parent on undo. Also keep handling of UMLAttribute instances in sync with UMLOperation and UMLTemplate which are only removed from the parent classifier and not deleted. BUG:372601 FIXED-IN:2.20.80 (KDE Applications 16.11.80)
-rw-r--r--umbrello/umldoc.cpp13
-rw-r--r--umbrello/umlmodel/classifier.cpp6
-rw-r--r--umbrello/umlmodel/umlcanvasobject.h2
3 files changed, 12 insertions, 9 deletions
diff --git a/umbrello/umldoc.cpp b/umbrello/umldoc.cpp
index 929c885..a7689cb 100644
--- a/umbrello/umldoc.cpp
+++ b/umbrello/umldoc.cpp
@@ -1117,10 +1117,8 @@ UMLClassifier* UMLDoc::findUMLClassifier(const QString &name)
*/
bool UMLDoc::addUMLObject(UMLObject* object)
{
- UMLObject::ObjectType ot = object->baseType();
- if (ot == UMLObject::ot_Attribute || ot == UMLObject::ot_Operation || ot == UMLObject::ot_EnumLiteral
- || ot == UMLObject::ot_EntityAttribute || ot == UMLObject::ot_Template || ot == UMLObject::ot_Stereotype) {
- DEBUG(DBG_SRC) << object->name() << ": not adding type " << ot;
+ if (object->isUMLStereotype()) {
+ DEBUG(DBG_SRC) << object->name() << ": not adding type " << object->baseTypeStr();
return false;
}
UMLPackage *pkg = object->umlPackage();
@@ -1131,6 +1129,13 @@ bool UMLDoc::addUMLObject(UMLObject* object)
object->setUMLPackage(pkg);
}
+ // FIXME restore stereotype
+ UMLClassifierListItem *c = object->asUMLClassifierListItem();
+ if (c) {
+ if (!pkg->subordinates().contains(c))
+ pkg->subordinates().append(c);
+ return true;
+ }
return pkg->addObject(object);
}
diff --git a/umbrello/umlmodel/classifier.cpp b/umbrello/umlmodel/classifier.cpp
index 4df7374..936ee14 100644
--- a/umbrello/umlmodel/classifier.cpp
+++ b/umbrello/umlmodel/classifier.cpp
@@ -889,12 +889,10 @@ int UMLClassifier::removeAttribute(UMLAttribute* att)
uDebug() << "cannot find att given in list";
return -1;
}
+ // note that we don't delete the attribute, just remove it from the Classifier
+ disconnect(att, SIGNAL(modified()), this, SIGNAL(modified()));
emit attributeRemoved(att);
UMLObject::emitModified();
- // If we are deleting the object, then we don't need to disconnect..this is done auto-magically
- // for us by QObject. -b.t.
- // disconnect(att, SIGNAL(modified()), this, SIGNAL(modified()));
- delete att;
return m_List.count();
}
diff --git a/umbrello/umlmodel/umlcanvasobject.h b/umbrello/umlmodel/umlcanvasobject.h
index d1d4547..5a7b74f 100644
--- a/umbrello/umlmodel/umlcanvasobject.h
+++ b/umbrello/umlmodel/umlcanvasobject.h
@@ -77,7 +77,7 @@ public:
virtual void removeAllChildObjects();
- UMLObjectList subordinates() const {
+ UMLObjectList &subordinates() {
return m_List;
}