| Summary: | associations with deleted classes persist in saved file | ||
|---|---|---|---|
| Product: | [Applications] umbrello | Reporter: | Marko Schuetz Schmuck <MarkoSchuetz> |
| Component: | general | Assignee: | Umbrello Development Group <umbrello-devel> |
| Status: | RESOLVED FIXED | ||
| Severity: | normal | ||
| Priority: | NOR | ||
| Version First Reported In: | unspecified | ||
| Target Milestone: | --- | ||
| Platform: | NetBSD pkgsrc | ||
| OS: | NetBSD | ||
| Latest Commit: | Version Fixed/Implemented In: | ||
| Sentry Crash Report: | |||
| Attachments: | bug100142-fix.diff | ||
|
Description
Marko Schuetz Schmuck
2005-02-24 05:44:58 UTC
You say "Select the classes and delete them". Do you mean in the diagram area or the list view? When I delete classes in the list view, the associations are no longer in the XMI file. Whoops, forget the previous comment. I do see the problem now. Created attachment 9827 [details] bug100142-fix.diff I plan to commit this as soon as we leave cvs freeze. Jon: Is this important enough to move the KDE_3_4_RELEASE tag? CVS commit by okellogg:
BUG:100142 - UMLCanvasObject::removeAllAssociations(): New.
M +1 -1 ChangeLog 1.69
M +21 -0 umbrello/umlcanvasobject.cpp 1.33
M +5 -0 umbrello/umlcanvasobject.h 1.22
M +12 -0 umbrello/umllistview.cpp 1.147
--- kdesdk/umbrello/ChangeLog #1.68:1.69
@@ -29,5 +29,5 @@
94728 94795 94883 95082 95247 95252 95722 95924 95951 95954
96216 96221 96964 97155 97182 97697 97887 97984 98603 98899
-99697
+ 99697 100142
Version 1.3
--- kdesdk/umbrello/umbrello/umlcanvasobject.cpp #1.32:1.33
@@ -7,4 +7,5 @@
* *
***************************************************************************/
+#include "uml.h"
#include "umldoc.h"
#include "umlcanvasobject.h"
@@ -27,4 +28,5 @@ UMLCanvasObject::UMLCanvasObject(const Q
////////////////////////////////////////////////////////////////////////////////////////////////////
UMLCanvasObject::~UMLCanvasObject() {
+ removeAllAssociations();
}
////////////////////////////////////////////////////////////////////////////////////////////////////
@@ -67,4 +69,23 @@ int UMLCanvasObject::removeAssociation(U
}
+void UMLCanvasObject::removeAllAssociations() {
+ UMLDoc *umldoc = UMLApp::app()->getDocument();
+ for (UMLAssociationListIt ait(m_AssocsList); ait.current(); ++ait) {
+ UMLAssociation *assoc = ait.current();
+ umldoc->slotRemoveUMLObject(assoc);
+ UMLCanvasObject *other = NULL;
+ UMLObject* objA = assoc->getObject(Uml::A);
+ UMLObject* objB = assoc->getObject(Uml::B);
+ if (objA == this)
+ other = dynamic_cast<UMLCanvasObject*>(objA);
+ else
+ other = dynamic_cast<UMLCanvasObject*>(objB);
+ if (other)
+ other->removeAssociation(assoc);
+ delete assoc;
+ }
+ m_AssocsList.clear();
+}
+
QString UMLCanvasObject::uniqChildName( const Uml::Object_Type type,
bool seekStereo /* = false */ ) {
--- kdesdk/umbrello/umbrello/umlcanvasobject.h #1.21:1.22
@@ -87,4 +87,9 @@ public:
/**
+ * Remove all associations from the CanvasObject.
+ */
+ void removeAllAssociations();
+
+ /**
* Returns the number of associations for the CanvasObject.
* This is the sum of the aggregations and compositions.
--- kdesdk/umbrello/umbrello/umllistview.cpp #1.146:1.147
@@ -377,4 +377,16 @@ void UMLListView::popupMenuSel(int sel)
}
m_doc->removeUMLObject(object);
+ UMLCanvasObject *canvasObj = dynamic_cast<UMLCanvasObject*>(object);
+ if (canvasObj) {
+ /**
+ * We cannot just delete canvasObj here: What if the object
+ * is still being used by others (for example, as a parameter
+ * or return type of an operation) ?
+ * Deletion should not have been permitted in the first place
+ * if the object still has users - but Umbrello is lacking
+ * that logic.
+ */
+ canvasObj->removeAllAssociations();
+ }
} else {
kdWarning() << "umllistview::listpopupmenu::mt_Delete called with unknown type"
|