[Uml-devel] branches/KDE/3.5/kdesdk/umbrello/umbrello

Oliver Kellogg okellogg at users.sourceforge.net
Sat Aug 27 10:56:56 UTC 2005


SVN commit 453995 by okellogg:

CCBUG:110843 - Fix for comment #9 From Yurgen Wolfgang 2005-08-20 15:22
> Tried to reduce the size of my file for uploading, but Umbrello 
> crashes every time I delete a class.


 M  +1 -1      associationwidget.cpp  
 M  +7 -8      umlcanvasobject.cpp  
 M  +5 -4      umldoc.cpp  
 M  +1 -4      umlview.cpp  


--- branches/KDE/3.5/kdesdk/umbrello/umbrello/associationwidget.cpp #453994:453995
@@ -778,7 +778,7 @@
         if (assoc && umla == assoc)
             return;
 
-        umla->disconnect(this);
+        //umla->disconnect(this);  //Qt does disconnect automatically upon destruction.
         umla->nrof_parent_widgets--;
 
         // we are the last "owner" of this association, so delete it
--- branches/KDE/3.5/kdesdk/umbrello/umbrello/umlcanvasobject.cpp #453994:453995
@@ -72,16 +72,15 @@
     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;
+        UMLCanvasObject *roleAObj = dynamic_cast<UMLCanvasObject*>(objA);
+        if (roleAObj)
+            roleAObj->removeAssociation(assoc);
+        UMLCanvasObject *roleBObj = dynamic_cast<UMLCanvasObject*>(objB);
+        if (roleBObj)
+            roleBObj->removeAssociation(assoc);
+        //delete assoc;  cannot do this! AssociationWidgets may exist!
     }
     m_AssocsList.clear();
 }
--- branches/KDE/3.5/kdesdk/umbrello/umbrello/umldoc.cpp #453994:453995
@@ -281,12 +281,12 @@
         if (m_objectList.count() > 0) {
             // clear our object list. We do this explicitly since setAutoDelete is false for the objectList now.
             for(UMLObject * obj = m_objectList.first(); obj != 0; obj = m_objectList.next())
-                ; //obj->deleteLater();
+                delete obj;
             m_objectList.clear();
         }
         if (m_stereoList.count() > 0) {
             for (UMLStereotype *s = m_stereoList.first(); s; s = m_stereoList.next())
-                ; //s->deleteLater();
+                delete s;
             m_stereoList.clear();
         }
     }
@@ -1448,11 +1448,12 @@
             }
         }
         UMLPackage* pkg = umlobject->getUMLPackage();
-        if (pkg)  {
+        if (pkg) {
             pkg->removeObject(umlobject);
+        } else {
+            m_objectList.remove(umlobject);
         }
         emit sigObjectRemoved(umlobject);
-        m_objectList.remove(umlobject);
     }
     setModified(true);
 }
--- branches/KDE/3.5/kdesdk/umbrello/umbrello/umlview.cpp #453994:453995
@@ -2003,11 +2003,8 @@
 
         m_pMoveAssoc = 0;
     }
-    // Remove the association in this view - but set the document
-    // modified BEFORE physically deleting it because it is still
-    // needed for an entry in the undo stack (when Undo is enabled.)
-    m_pDoc->setModified();
     m_AssociationList.remove(pAssoc); // will delete our association
+    m_pDoc->setModified();
 }
 
 void UMLView::removeAssocInViewAndDoc(AssociationWidget* a) {




More information about the umbrello-devel mailing list