[Uml-devel] kde4 umbrello: identified and fixed problem with association names

Danny Beullens dbeullens at tiscalinet.be
Mon May 7 21:55:38 UTC 2007


I noticed that upon adding a name to an association between two classes
in a class diagram that the following error was reported:

> umbrello: ERROR: UMLView::addWidget: Not adding
(id=8hl7Jptd2cPx/type=313 /name=new_class_1) because it's already there

Later on when deleting the association relationship from the diagram,
the widget containing the name became stuck on the diagram. There is no
way to remove it.

What happened:
As the error indicates umbrello failed to add the widget to the
m_WidgetList of the UmlView. This list has the autodelete flag set, so
cleanup relies on the automatic deletion when removing the widget from
the list (UMLView::removeWidget). But as the association name widget was
not added to this list, as a result the widget is never deleted.

Reason for this bug:
Upon creation of the association name widget in
AssociationWidget::setName, the following is coded:

if (m_role[B].m_pWidget)
m_pName->setUMLObject(m_role[B].m_pWidget->getUMLObject());

this assigns the ID of one of the classes (the one with role B) in the
association to the new association name widget. Upon adding the
association name widget to the m_WidgetList, the code first checks
whether a widget with this id is not already added and in case there is
already one, the addition is refused (which produces the first error).

I removed the lines: 
if (m_role[B].m_pWidget)
m_pName->setUMLObject(m_role[B].m_pWidget->getUMLObject());

and then everything worked fine.
But what is/was the reason to assign the identity of the class with the
role B to the association name widget?? Is is breaking something else??

Rgrds,
Danny







More information about the umbrello-devel mailing list