Bug 146071

Summary: Diamond placed at wrong end on creating multiple mutual compositions/aggregations
Product: [Applications] umbrello Reporter: Carlos Aceituno <cdaceituno>
Component: generalAssignee: Umbrello Development Group <umbrello-devel>
Status: RESOLVED FIXED    
Severity: normal CC: ralf.habacker
Priority: NOR    
Version: unspecified   
Target Milestone: ---   
Platform: Debian testing   
OS: Linux   
Latest Commit: Version Fixed In: 2.21.2 (KDE Applications 16.12.2)
Sentry Crash Report:

Description Carlos Aceituno 2007-05-28 15:09:23 UTC
Version:           1.5.7 (using KDE KDE 3.5.7)
Installed from:    Debian testing/unstable Packages
Compiler:          gcc version 4.1.3 20070514 (prerelease) (Debian 4.1.2-7) 
OS:                Linux

When a class is associated to another more than once (for example, two attributes of the same class in another class), umbrello places the names of the two attributes (the labels) one on the top of the other. If you move the class trying to solve this, one of the labels moves but the other stands still.  Then, if you try to select that association to reset the label's position, umbrello hangs.

This happens with umbrello 1.5.7 compiled from sources in Debian testing/unstable.
Comment 1 Oliver Kellogg 2007-05-31 07:00:42 UTC
Cannot confirm but commit 669599 may have lifted the problem - I'm not sure.
Could someone please verify using umbrello from branches/KDE/3.5/kdesdk
as follows:
*  ./configure --enable-debug=full
*  Build, run the program in gdb
*  If the lockup happens, press Control-C in the debug console
*  Enter "bt" on the gdb command line
*  Attach the backtrace to this bug report

Thanks.
Comment 3 Carlos Aceituno 2007-05-31 12:06:55 UTC
Ok, I attach both the last thing executed and the hang backtrace after compiling with full debugging. Umbrello hanged but its window remains.

Program received signal SIGSEGV, Segmentation fault.
[Switching to Thread -1502898480 (LWP 18666)]
0x081751dc in FloatingTextWidgetController::constrainPosition (this=0x880e3d8, diffX=0, diffY=1) at floatingtextwidgetcontroller.cpp:109
109                         m_floatingTextWidget->m_Role);

(gdb) backtrace

#0  0x081751dc in FloatingTextWidgetController::constrainPosition (this=0x880e3d8, diffX=0, diffY=1) at floatingtextwidgetcontroller.cpp:109
#1  0x08175284 in FloatingTextWidgetController::constrainMovementForAllWidgets (this=0x880e3d8, diffX=@0xafeb5610, diffY=@0xafeb560c)
    at floatingtextwidgetcontroller.cpp:96
#2  0x081eaf68 in UMLWidgetController::mouseMoveEvent (this=0x880e3d8, me=0x854ad58) at umlwidgetcontroller.cpp:149
#3  0x081a8abb in ToolBarStateArrow::mouseMoveWidget (this=0x8574a28) at toolbarstatearrow.cpp:97
#4  0x081a8477 in ToolBarState::mouseMove (this=0x8574a28, ome=0xafeb56ac) at toolbarstate.cpp:120
#5  0xa7050c81 in QScrollView::viewportMouseMoveEvent () from /usr/lib/libqt-mt.so.3
#6  0xa7052452 in QScrollView::eventFilter () from /usr/lib/libqt-mt.so.3
#7  0xa6f1c302 in QObject::activate_filters () from /usr/lib/libqt-mt.so.3
#8  0xa6f1c380 in QObject::event () from /usr/lib/libqt-mt.so.3
#9  0xa6f53612 in QWidget::event () from /usr/lib/libqt-mt.so.3
#10 0xa6eb4c26 in QApplication::internalNotify () from /usr/lib/libqt-mt.so.3
#11 0xa6eb6dc9 in QApplication::notify () from /usr/lib/libqt-mt.so.3
#12 0xa765ccce in KApplication::notify () from /usr/lib/libkdecore.so.4
#13 0xa6e48495 in QApplication::sendSpontaneousEvent () from /usr/lib/libqt-mt.so.3
#14 0xa6e4712f in QETWidget::translateMouseEvent () from /usr/lib/libqt-mt.so.3
#15 0xa6e456b0 in QApplication::x11ProcessEvent () from /usr/lib/libqt-mt.so.3
#16 0xa6e5bd02 in QEventLoop::processEvents () from /usr/lib/libqt-mt.so.3
#17 0xa6ecf179 in QEventLoop::enterLoop () from /usr/lib/libqt-mt.so.3
#18 0xa6ecef9a in QEventLoop::exec () from /usr/lib/libqt-mt.so.3
#19 0xa6eb67bf in QApplication::exec () from /usr/lib/libqt-mt.so.3
#20 0x0818bc5c in main (argc=1, argv=0x0) at main.cpp:137
Comment 4 Carlos Aceituno 2007-05-31 12:18:14 UTC
I have just had another hang while doing basically the same. I've checked the backtrace and it is different, so I attach it too:

Program received signal SIGSEGV, Segmentation fault.
[Switching to Thread -1502947632 (LWP 23161)]
0x08142939 in AssociationWidget::calculateTextPosition (this=0x883bf00, role=Uml::tr_Name) at associationwidget.cpp:1798
1798            calculateNameTextSegment();

(gdb) backtrace

#0  0x08142939 in AssociationWidget::calculateTextPosition (this=0x883bf00, role=Uml::tr_Name) at associationwidget.cpp:1798
#1  0x08142f76 in AssociationWidget::saveIdealTextPositions (this=0x883bf00) at associationwidget.cpp:1268
#2  0x081e8839 in UMLWidget::adjustAssocs (this=0x8d4a2a8, x=1662, y=1394) at umlwidget.cpp:570
#3  0x081598e8 in ClassifierWidget::adjustAssocs (this=0x8d4a2a8, x=1662, y=1394) at classifierwidget.cpp:748
#4  0x081ead87 in UMLWidgetController::mouseReleaseEvent (this=0x8d4a3c8, me=0x84a2688) at umlwidgetcontroller.cpp:216
#5  0x081a8a68 in ToolBarStateArrow::mouseReleaseWidget (this=0x8d45908) at toolbarstatearrow.cpp:73
#6  0x081a8654 in ToolBarState::mouseRelease (this=0x8d45908, ome=0xaffa8cdc) at toolbarstate.cpp:84
#7  0xa7044e51 in QScrollView::viewportMouseReleaseEvent () from /usr/lib/libqt-mt.so.3
#8  0xa70463de in QScrollView::eventFilter () from /usr/lib/libqt-mt.so.3
#9  0xa6f10302 in QObject::activate_filters () from /usr/lib/libqt-mt.so.3
#10 0xa6f10380 in QObject::event () from /usr/lib/libqt-mt.so.3
#11 0xa6f47612 in QWidget::event () from /usr/lib/libqt-mt.so.3
#12 0xa6ea8c26 in QApplication::internalNotify () from /usr/lib/libqt-mt.so.3
#13 0xa6eaadc9 in QApplication::notify () from /usr/lib/libqt-mt.so.3
#14 0xa7650cce in KApplication::notify () from /usr/lib/libkdecore.so.4
#15 0xa6e3c495 in QApplication::sendSpontaneousEvent () from /usr/lib/libqt-mt.so.3
#16 0xa6e3b12f in QETWidget::translateMouseEvent () from /usr/lib/libqt-mt.so.3
#17 0xa6e396b0 in QApplication::x11ProcessEvent () from /usr/lib/libqt-mt.so.3
#18 0xa6e4fd02 in QEventLoop::processEvents () from /usr/lib/libqt-mt.so.3
#19 0xa6ec3179 in QEventLoop::enterLoop () from /usr/lib/libqt-mt.so.3
#20 0xa6ec2f9a in QEventLoop::exec () from /usr/lib/libqt-mt.so.3
#21 0xa6eaa7bf in QApplication::exec () from /usr/lib/libqt-mt.so.3
#22 0x0818bc5c in main (argc=1, argv=0x883bf10) at main.cpp:137
Comment 5 Oliver Kellogg 2007-06-01 20:30:33 UTC
Thanks for the traces.
Before I analyze further: Can you produce the problem also with
http://uml.sourceforge.net/developers/umbrello.tar.bz2 ?
Comment 6 Carlos Aceituno 2007-06-04 11:39:27 UTC
I've tried ro reproduce it but it seems to be resolved in the umbrello.tar.bz2 release. However, the associations (compositions, actually) appear pointing in different senses. I don't know if I've made myself clear, so I'll try to illustrate it with a bit of ASCII art...

---------               ---------
|Entity1|<>-------------|Entity2|
|       |-------------<>|       |
---------               ---------

It is one of the classes containing two instances of the other, so both compositions should point to the same entity, shouldn't it? (I'm no uml expert). In the previous release it was that way (and then hanged :-)

By the way, thank you very much for creating the bz2 release!

Comment 7 Oliver Kellogg 2007-06-05 21:09:18 UTC
> However, the associations (compositions, actually) appear pointing in
> different senses.

Does not happen to me. Here is what I tried:

* Create two classes in the list view, c1 and c2
* Create two new attributes in the list view at c2, a1 and a2, of type c1
* Drag both c1 and c2 to a class diagram
* The compositions are both shown in the proper direction
* Save file, close, load file again: compositions still okay
Comment 8 Oliver Kellogg 2007-06-05 23:52:02 UTC
> Does not happen to me. Here is what I tried:
> [...]

I do confirm Comment #6.
All it took was adding an attribute of type c2 at c1.
Comment 9 Ralf Habacker 2015-06-18 13:01:29 UTC
(In reply to Oliver Kellogg from comment #8)
> > Does not happen to me. Here is what I tried:
> > [...]
> 
> I do confirm Comment #6.
> All it took was adding an attribute of type c2 at c1.

because in bool AssocRules::allowAssociation() starting with line 212ff there is code to exclude mutual compositions, which fails to detect this case.

    case Uml::AssociationType::Composition:   // can't have mutual composition
    case Uml::AssociationType::Containment:   // can't have mutual containment
    case Uml::AssociationType::Generalization://can have many sub/super types but can't sup/sub each
        foreach (AssociationWidget * assoc, list) {
            if((widgetA == assoc->widgetForRole(Uml::RoleType::A) ||
                        widgetA == assoc->widgetForRole(Uml::RoleType::B))
                    && assoc->associationType() == assocType)
                return false;
        }
        return true;
        break;
Comment 10 Ralf Habacker 2017-01-10 12:33:40 UTC
Git commit a14a450b7495d179c1bb47ea07406d3b5a829df2 by Ralf Habacker.
Committed on 10/01/2017 at 12:33.
Pushed by habacker into branch 'Applications/16.12'.

Fix 'Diamond placed at wrong end on creating multiple mutual compositions/aggregations'.

Mutual compositions/aggregations were not enabled.
FIXED-IN:2.21.2 (KDE Applications 16.12.2)

M  +5    -2    umbrello/assocrules.cpp

https://commits.kde.org/umbrello/a14a450b7495d179c1bb47ea07406d3b5a829df2