Bug 94728 - using a containment will crash umbrello
Summary: using a containment will crash umbrello
Status: RESOLVED FIXED
Alias: None
Product: umbrello
Classification: Applications
Component: general (show other bugs)
Version: 1.3.2
Platform: openSUSE Linux
: NOR crash
Target Milestone: ---
Assignee: Umbrello Development Group
URL:
Keywords:
Depends on:
Blocks:
 
Reported: 2004-12-09 10:35 UTC by Leo Blommers
Modified: 2004-12-09 21:36 UTC (History)
0 users

See Also:
Latest Commit:
Version Fixed In:


Attachments

Note You need to log in before you can comment on or make changes to this bug.
Description Leo Blommers 2004-12-09 10:35:46 UTC
Version:           1.3.2 (using KDE KDE 3.3.2)
Installed from:    SuSE RPMs
OS:                Linux

Create two classes, and add a containment relationship. Next remove the containment relationship. The class list still shows the relationship. If you now try to make a new containment relationship between the two classes umbrello will crash.
Comment 1 Chris 2004-12-09 15:29:36 UTC
*** This bug has been confirmed by popular vote. ***
Comment 2 Oliver Kellogg 2004-12-09 21:36:12 UTC
CVS commit by okellogg: 

slotMenuSelection(mt_Delete): In case of a containment, determine the new
 parent in the list view.
BUG:94728


  M +31 -5     associationwidget.cpp   1.134


--- kdesdk/umbrello/umbrello/associationwidget.cpp  #1.133:1.134
@@ -12,7 +12,14 @@
  *                                                                         *
  ***************************************************************************/
+
+// own header
+#include "associationwidget.h"
+// system includes
 #include <cstdlib>
 #include <cmath>
-
+// qt/kde includes
+#include <kdebug.h>
+#include <klocale.h>
+// app includes
 #include "activitywidget.h"
 #include "uml.h"
@@ -26,5 +33,4 @@
 #include "attribute.h"
 #include "association.h"
-#include "associationwidget.h"
 #include "assocrules.h"
 #include "floatingtext.h"
@@ -33,7 +39,6 @@
 #include "dialogs/assocpropdlg.h"
 #include "inputdialog.h"
-
-#include <kdebug.h>
-#include <klocale.h>
+#include "umllistview.h"
+#include "umllistviewitem.h"
 
 using namespace Uml;
@@ -2101,4 +2106,25 @@ void AssociationWidget::slotMenuSelectio
 
         case ListPopupMenu::mt_Delete:
+                if (getAssocType() == at_Containment) {
+                        UMLListView *lv = UMLApp::app()->getListView();
+                        UMLObject *oldContainer = getWidget(A)->getUMLObject();
+                        UMLObject *objToBeMoved = getWidget(B)->getUMLObject();
+                        if (objToBeMoved == NULL) {
+                                m_pView->removeAssocInViewAndDoc(this);
+                                return;
+                        }
+                        UMLListViewItem *newLVParent = NULL;
+                        if (oldContainer) {
+                                UMLListViewItem *oldLVParent = lv->findUMLObject(oldContainer);
+                                if (oldLVParent)
+                                        newLVParent = dynamic_cast<UMLListViewItem*>(oldLVParent->parent());
+                        }
+                        if (newLVParent == NULL)
+                                newLVParent = lv->theLogicalView();
+                        Object_Type ot = objToBeMoved->getBaseType();
+                        lv->moveObject( objToBeMoved->getID(),
+                                        UMLListView::convert_OT_LVT(ot),
+                                        newLVParent );
+                }
                 m_pView->removeAssocInViewAndDoc(this);
                 break;