[Uml-devel] kdesdk/umbrello/umbrello
Brian Thomas
thomas at mail630.gsfc.nasa.gov
Tue Sep 30 12:20:10 UTC 2003
CVS commit by thomas:
bug fix: couldnt delete attributes/operations when had generated code. This is basicially a bug caused by a 'race' condition: the umldoc would autoDelete the object (from objList) BEFORE the codedocument/textblock that was linked to the object could exit itself. Now fixed by having things deleted by their parent objects rather than the UMLDocuemnt.
M +4 -1 class.cpp 1.16
M +4 -1 classifier.cpp 1.15
M +10 -5 umldoc.cpp 1.76
--- kdesdk/umbrello/umbrello/class.cpp #1.15:1.16
@@ -84,5 +84,8 @@ int UMLClass::removeAttribute(UMLObject*
emit attributeRemoved(a);
emit modified();
- disconnect(a,SIGNAL(modified()),this,SIGNAL(modified()));
+ // If we are deleteing the object, then we dont need to disconnect..this is done auto-magically
+ // for us by QObject. -b.t.
+ // disconnect(a,SIGNAL(modified()),this,SIGNAL(modified()));
+ delete a;
return m_AttsList.count();
}
--- kdesdk/umbrello/umbrello/umldoc.cpp #1.75:1.76
@@ -64,5 +64,5 @@ UMLDoc::UMLDoc(QWidget *parent, const ch
m_currentcodegenerator = 0;
objectList.clear();
- objectList.setAutoDelete(true);
+ objectList.setAutoDelete(false); // DONT autodelete
diagrams.setAutoDelete(true);
m_ViewList.setAutoDelete(true);
@@ -771,5 +772,8 @@ UMLObject* UMLDoc::createOperation(UMLCl
int id = getUniqueID();
QString currentName = classifier->uniqChildName(Uml::ot_Operation);
+/*
newOperation = new UMLOperation(classifier, currentName, id);
+*/
+ newOperation = (UMLOperation*) classifier->addOperation(currentName, id);
int button = QDialog::Accepted;
@@ -792,10 +796,12 @@ UMLObject* UMLDoc::createOperation(UMLCl
}
- classifier->addOperation(newOperation);
+ //classifier->addOperation(newOperation);
// addUMLObject(newOperation);
+ if(newOperation) {
setModified(true);
emit sigObjectCreated(newOperation);
+ }
return newOperation;
@@ -1123,5 +1129,4 @@ void UMLDoc::removeUMLObject(UMLObject *
if (type == ot_Operation) {
p->removeOperation(o);
- delete o;
} else if (type == ot_Attribute) {
UMLClass *pClass = dynamic_cast<UMLClass *>(p);
--- kdesdk/umbrello/umbrello/classifier.cpp #1.14:1.15
@@ -74,7 +74,10 @@ int UMLClassifier::removeOperation(UMLOb
return -1;
}
+ // disconnection needed? operationRemoved signal will triggler UMLDoc to delete it
+ // which will also (naturally) disconnect the operation from this object) -b.t.
+ // disconnect(o,SIGNAL(modified()),this,SIGNAL(modified()));
emit operationRemoved(o);
emit modified();
- disconnect(o,SIGNAL(modified()),this,SIGNAL(modified()));
+ delete o;
return m_OpsList.count();
}
More information about the umbrello-devel
mailing list