Bug 141385

Summary: ERD not saved correctly, rendered unusable
Product: [Applications] umbrello Reporter: Piotr Keplicz <keplicz>
Component: generalAssignee: Oliver Kellogg <okellogg>
Status: RESOLVED FIXED    
Severity: normal    
Priority: NOR    
Version: unspecified   
Target Milestone: ---   
Platform: Ubuntu   
OS: Linux   
Latest Commit: Version Fixed In:
Sentry Crash Report:
Attachments: test1.xmi: ERD after first save/exit
test2.xmi: ERD after second save/exit
test3.xmi: ERD after third save/exit

Description Piotr Keplicz 2007-02-08 09:41:46 UTC
Version:           1.5.6 (using KDE KDE 3.5.6)
Installed from:    Ubuntu Packages
OS:                Linux

Entity-relationship diagrams are not saved correctly. After having saved and reopened the a couple of times, entities' attributes and entities themselves vanish gradually.

Steps to reproduce:
1. Create a simple ERD with one entity, add three attributes (in the attached test case: test1 and test2 as 'int', test3 as 'text', no additional properties).
2. Save and exit (resulting file: test1.xmi)
3. Reopen.
-- Some attributes disappear, some change their type.
4. Click 'Save' and exit (resulting file: test2.xmi).
5. Reopen (the entity disappears), click 'Save' and exit (resulting file: test3.xmi).
Comment 1 Piotr Keplicz 2007-02-08 09:42:42 UTC
Created attachment 19586 [details]
test1.xmi: ERD after first save/exit
Comment 2 Piotr Keplicz 2007-02-08 09:44:30 UTC
Created attachment 19587 [details]
test2.xmi: ERD after second save/exit
Comment 3 Piotr Keplicz 2007-02-08 09:45:55 UTC
Created attachment 19588 [details]
test3.xmi: ERD after third save/exit
Comment 4 Piotr Keplicz 2007-02-08 09:57:58 UTC
Possibly related with #141064.
Comment 5 Oliver Kellogg 2007-02-08 23:28:35 UTC
SVN commit 631744 by okellogg:

getDatatypes(): Interestingly, in the line
  UMLObjectListIt oit(m_datatypeRoot->containedObjects());
the iterator is always constructed on an empty list. If we instead write
  UMLObjectList objects = m_datatypeRoot->containedObjects();
  UMLObjectListIt oit(objects);
then all is fine.
CCBUG:141385


 M  +2 -2      umldoc.cpp  


--- branches/KDE/3.5/kdesdk/umbrello/umbrello/umldoc.cpp #631743:631744
@@ -1870,10 +1870,10 @@
 }
 
 UMLClassifierList UMLDoc::getDatatypes() {
+    UMLObjectList objects = m_datatypeRoot->containedObjects();
     UMLClassifierList datatypeList;
     UMLObject *obj;
-    for (UMLObjectListIt oit(m_datatypeRoot->containedObjects());
-            (obj = oit.current()) != NULL; ++oit) {
+    for (UMLObjectListIt oit(objects); (obj = oit.current()) != NULL; ++oit) {
         if (obj->getBaseType() == ot_Datatype) {
             datatypeList.append(static_cast<UMLClassifier*>(obj));
         }
Comment 6 Oliver Kellogg 2007-02-08 23:31:21 UTC
I'm not quite sure whether the above fix closes this PR out entirely.
Could someone please verify, thanks.
Comment 7 Oliver Kellogg 2007-02-16 19:38:51 UTC
I will close this unless I hear back within a few days...
Comment 8 Piotr Keplicz 2007-02-27 09:22:31 UTC
I've just installed 1.5.61, which contains this patch. Looks fine, diagrams seem to be saved correctly. Thanks!
Comment 9 Oliver Kellogg 2007-02-27 18:49:04 UTC
Thanks.