Summary: | Crash when opening a document | ||
---|---|---|---|
Product: | [Applications] umbrello | Reporter: | Maruschenko Dmitry <maruschenko> |
Component: | general | Assignee: | Oliver Kellogg <okellogg> |
Status: | RESOLVED FIXED | ||
Severity: | crash | ||
Priority: | HI | ||
Version: | unspecified | ||
Target Milestone: | --- | ||
Platform: | Ubuntu | ||
OS: | Linux | ||
Latest Commit: | Version Fixed In: | ||
Sentry Crash Report: | |||
Attachments: | bug135749-no-listview.xmi |
Description
Maruschenko Dmitry
2006-10-16 14:17:45 UTC
Next time, please use attachments instead of pasting the Umbrello XML file into the report directly. Created attachment 18143 [details] bug135749-no-listview.xmi After removing the <listview> from the <XMI.extensions> umbrello at least no longer crashes. Ugh, bad. Will try to fix this before the 1.5.5 standalone release. "Диаграмма классов" has xmi.id="1" which conflicts with the xmi.id of the Logical View. By changing that to a different, unused value, at least the diagra, icon shows up in the list view. However when clicking on that diagram, nothing is displayed (according to the XMI, there should be two classwidgets, a boxwidget, and a floatingtext.) Strange. SVN commit 597279 by okellogg: Avoid using numeric IDs for the root folders - they may collide with ID numbers from pre-1.5.5 files. Note to users: Please do not use the Umbrello that comes with KDE 3.5.5. The corrected version will be released shortly at http://uml.sf.net CCBUG:135749 M +5 -4 umldoc.cpp --- branches/KDE/3.5/kdesdk/umbrello/umbrello/umldoc.cpp #597278:597279 @@ -114,10 +114,10 @@ i18n("Entity Relationship Model") }; for (int i = 0; i < Uml::N_MODELTYPES; i++) { - m_root[i] = new UMLFolder(nativeRootName[i]); + m_root[i] = new UMLFolder(nativeRootName[i], STR2ID(nativeRootName[i])); m_root[i]->setLocalName(localizedRootName[i]); } - m_datatypeRoot = new UMLFolder("Datatypes"); + m_datatypeRoot = new UMLFolder("Datatypes", "Datatypes"); m_datatypeRoot->setLocalName(i18n("Datatypes")); m_datatypeRoot->setUMLPackage(m_root[Uml::mt_Logical]); m_root[Uml::mt_Logical]->addObject(m_datatypeRoot); @@ -302,7 +302,7 @@ for (int i = 0; i < Uml::N_MODELTYPES; i++) m_root[i]->removeAllObjects(); // Restore the datatype folder, it has been deleted above. - m_datatypeRoot = new UMLFolder("Datatypes"); + m_datatypeRoot = new UMLFolder("Datatypes", "Datatypes"); m_datatypeRoot->setLocalName(i18n("Datatypes")); m_datatypeRoot->setUMLPackage(m_root[Uml::mt_Logical]); m_root[Uml::mt_Logical]->addObject(m_datatypeRoot); @@ -852,7 +852,8 @@ } UMLStereotype* UMLDoc::findStereotype(const QString &name) { - for (UMLStereotype *s = m_stereoList.first(); s; s = m_stereoList.next() ) { + UMLStereotype *s; + for (UMLStereotypeListIt it(m_stereoList); (s = it.current()) != NULL; ++it) { if (s->getName() == name) return s; } > Comment #4 From Oliver Kellogg
> [...] However when clicking on that
> diagram, nothing is displayed (according to the XMI, there should be
> two classwidgets, a boxwidget, and a floatingtext.) Strange.
Forget that, the widgets are there (use scrolling.)
Fixed on the premises of using a 1.5.4 generated XMI file, loading it into the branches/KDE/3.5/umbrello r597310, saving to a different file, and loading that file. Please reopen if need be. SVN commit 597310 by okellogg: removeObject(): Use UMLCanvasObject::removeAssociation() if the base type is ot_Association. resolveRef(): Remove obj from m_objects if obj->resolveRef() fails. CCBUG:135749 M +12 -3 package.cpp --- branches/KDE/3.5/kdesdk/umbrello/umbrello/package.cpp #597309:597310 @@ -76,7 +76,14 @@ } void UMLPackage::removeObject(const UMLObject *pObject) { - m_objects.remove( pObject ); + if (pObject->getBaseType() == Uml::ot_Association) { + UMLObject *o = const_cast<UMLObject*>(pObject); + UMLAssociation *assoc = static_cast<UMLAssociation*>(o); + UMLCanvasObject::removeAssociation(assoc); + delete assoc; + } else { + m_objects.remove(pObject); + } } void UMLPackage::removeAllObjects() { @@ -86,7 +93,7 @@ UMLPackage *pkg = dynamic_cast<UMLPackage*>(o); if (pkg) pkg->removeAllObjects(); - //delete o; + delete o; } m_objects.clear(); } @@ -184,8 +191,10 @@ bool overallSuccess = UMLCanvasObject::resolveRef(); for (UMLObjectListIt oit(m_objects); oit.current(); ++oit) { UMLObject *obj = oit.current(); - if (! obj->resolveRef()) + if (! obj->resolveRef()) { + m_objects.remove(obj); overallSuccess = false; + } } return overallSuccess; } SVN commit 597308 by okellogg: removeAllAssociations(): If the role{A,B}Obj->removeAssociation() fails then remove the assoc from this->m_List. CCBUG:135749 M +12 -8 umlcanvasobject.cpp --- branches/KDE/3.5/kdesdk/umbrello/umbrello/umlcanvasobject.cpp #597307:597308 @@ -85,7 +85,7 @@ int UMLCanvasObject::removeAssociation(UMLAssociation * assoc) { if(!hasAssociation(assoc) || !m_List.remove(assoc)) { kdWarning() << "UMLCanvasObject::removeAssociation: " - << "can't find assoc given in list" << endl; + << "can't find given assoc in list" << endl; return -1; } emit modified(); @@ -103,9 +103,10 @@ UMLObject* objA = assoc->getObject(Uml::A); UMLObject* objB = assoc->getObject(Uml::B); UMLCanvasObject *roleAObj = dynamic_cast<UMLCanvasObject*>(objA); - if (roleAObj) - roleAObj->removeAssociation(assoc); - else if (objA) + if (roleAObj) { + if (roleAObj->removeAssociation(assoc) < 0) + m_List.remove(assoc); + } else if (objA) kdDebug() << "UMLCanvasObject::removeAllAssociations(" << m_Name << "): objA " << objA->getName() << " is not a UMLCanvasObject" << endl; @@ -113,9 +114,10 @@ kdDebug() << "UMLCanvasObject::removeAllAssociations(" << m_Name << "): objA is NULL" << endl; UMLCanvasObject *roleBObj = dynamic_cast<UMLCanvasObject*>(objB); - if (roleBObj) - roleBObj->removeAssociation(assoc); - else if (objB) + if (roleBObj) { + if (roleBObj->removeAssociation(assoc) < 0) + m_List.remove(assoc); + } else if (objB) kdDebug() << "UMLCanvasObject::removeAllAssociations(" << m_Name << "): objB " << objB->getName() << " is not a UMLCanvasObject" << endl; @@ -289,8 +291,10 @@ bool overallSuccess = UMLObject::resolveRef(); for (UMLObjectListIt ait(m_List); ait.current(); ++ait) { UMLObject *obj = ait.current(); - if (! obj->resolveRef()) + if (! obj->resolveRef()) { + m_List.remove(obj); overallSuccess = false; + } } return overallSuccess; } Further tests show that there are still problems, for example on exiting: #7 0x00000000 in ?? () #8 0x0812a46e in UMLAssociation::getObjectId (this=0x8938f18, role=A) at /kdesdk-3.5-branch/umbrello/umbrello/association.cpp:458 #9 0x081274d2 in UMLAssociation::saveToXMI (this=0x8938f18, qDoc=@0xbfffdc30, qElement=@0xbfffd8d0) at /kdesdk-3.5-branch/umbrello/umbrello/association.cpp:167 #10 0x0816acdf in UMLFolder::saveContents (this=0x84c8f68, qDoc=@0xbfffdc30, qElement=@0xbfffd910) at /kdesdk-3.5-branch/umbrello/umbrello/folder.cpp:185 #11 0x0816af96 in UMLFolder::save (this=0x84c8f68, qDoc=@0xbfffdc30, qElement=@0xbfffdb50) at /kdesdk-3.5-branch/umbrello/umbrello/folder.cpp:208 #12 0x0816b01b in UMLFolder::saveToXMI (this=0x84c8f68, qDoc=@0xbfffdc30, qElement=@0xbfffdb50) at /kdesdk-3.5-branch/umbrello/umbrello/folder.cpp:214 #13 0x081be2b0 in UMLDoc::saveToXMI (this=0x84c8d00, file=@0x89a2260) at /kdesdk-3.5-branch/umbrello/umbrello/umldoc.cpp:1385 #14 0x081c39c7 in UMLDoc::addToUndoStack (this=0x84c8d00) at /kdesdk-3.5-branch/umbrello/umbrello/umldoc.cpp:2224 #15 0x081c29e8 in UMLDoc::setModified (this=0x84c8d00, modified=true, addToUndo=true) at /kdesdk-3.5-branch/umbrello/umbrello/umldoc.cpp:2014 #16 0x081bcc42 in UMLDoc::changeCurrentView (this=0x84c8d00, id= {static npos = 4294967295, _M_dataplus = {<std::allocator<char>> = {<No data fields>}, _M_p = 0x89304f4 "25752"}, static _S_empty_rep_storage = {0, 0, 0, 0}}) at /kdesdk-3.5-branch/umbrello/umbrello/umldoc.cpp:1148 #17 0x081bc2d8 in UMLDoc::createDiagram (this=0x84c8d00, folder=0x84c8f68, type=dt_Class, askForName=false) at /kdesdk-3.5-branch/umbrello/umbrello/umldoc.cpp:1058 #18 0x081b827f in UMLDoc::newDocument (this=0x84c8d00) at /kdesdk-3.5-branch/umbrello/umbrello/umldoc.cpp:334 #19 0x081af777 in UMLApp::slotFileNew (this=0x84b8b28) at /kdesdk-3.5-branch/umbrello/umbrello/uml.cpp:673 Or on closing (always with Undo enabled): #7 0x0867f8be in ?? () #8 0x081dac60 in UMLRole::saveToXMI (this=0x8680f10, qDoc=@0xbfffdc30, qElement=@0xbfffd820) at /kdesdk-3.5-branch/umbrello/umbrello/umlrole.cpp:101 #9 0x081279d2 in UMLAssociation::saveToXMI (this=0x8680ea0, qDoc=@0xbfffdc30, qElement=@0xbfffd8d0) at /kdesdk-3.5-branch/umbrello/umbrello/association.cpp:188 #10 0x0816acdf in UMLFolder::saveContents (this=0x84c8f38, qDoc=@0xbfffdc30, qElement=@0xbfffd910) at /kdesdk-3.5-branch/umbrello/umbrello/folder.cpp:185 #11 0x0816af96 in UMLFolder::save (this=0x84c8f38, qDoc=@0xbfffdc30, qElement=@0xbfffdb50) at /kdesdk-3.5-branch/umbrello/umbrello/folder.cpp:208 #12 0x0816b01b in UMLFolder::saveToXMI (this=0x84c8f38, qDoc=@0xbfffdc30, qElement=@0xbfffdb50) at /kdesdk-3.5-branch/umbrello/umbrello/folder.cpp:214 #13 0x081be2b0 in UMLDoc::saveToXMI (this=0x84c8cd0, file=@0x86b9788) at /kdesdk-3.5-branch/umbrello/umbrello/umldoc.cpp:1385 #14 0x081c39c7 in UMLDoc::addToUndoStack (this=0x84c8cd0) at /kdesdk-3.5-branch/umbrello/umbrello/umldoc.cpp:2224 #15 0x081c29e8 in UMLDoc::setModified (this=0x84c8cd0, modified=true, addToUndo=true) at /kdesdk-3.5-branch/umbrello/umbrello/umldoc.cpp:2014 #16 0x081bcc42 in UMLDoc::changeCurrentView (this=0x84c8cd0, id= {static npos = 4294967295, _M_dataplus = {<std::allocator<char>> = {<No data fields>}, _M_p = 0x84c9a84 "128"}, static _S_empty_rep_storage = {0, 0, 0, 0}}) at /kdesdk-3.5-branch/umbrello/umbrello/umldoc.cpp:1148 #17 0x081bc2d8 in UMLDoc::createDiagram (this=0x84c8cd0, folder=0x84c8f38, type=dt_Class, askForName=false) at /kdesdk-3.5-branch/umbrello/umbrello/umldoc.cpp:1058 #18 0x081b827f in UMLDoc::newDocument (this=0x84c8cd0) at /kdesdk-3.5-branch/umbrello/umbrello/umldoc.cpp:334 #19 0x081af777 in UMLApp::slotFileNew (this=0x84b8af8) at /kdesdk-3.5-branch/umbrello/umbrello/uml.cpp:673 #20 0x081b039f in UMLApp::slotFileClose (this=0x84b8af8) at /kdesdk-3.5-branch/umbrello/umbrello/uml.cpp:795 Remaining problem of crash at exit is fixed by SVN commit 598502 by okellogg: removeAllAssociations(): Do not increment the iterator when positioned on an association. Remove the association from m_List unconditionally. M +4 -0 ChangeLog M +1 -1 VERSION M +7 -6 umbrello/umlcanvasobject.cpp |