Bug 141279 - Crash on openning xmi file produced by previous version of Umbrello
Summary: Crash on openning xmi file produced by previous version of Umbrello
Status: RESOLVED WORKSFORME
Alias: None
Product: umbrello
Classification: Applications
Component: general (show other bugs)
Version: 1.5.2
Platform: Ubuntu Linux
: NOR crash
Target Milestone: ---
Assignee: Umbrello Development Group
URL:
Keywords:
Depends on:
Blocks:
 
Reported: 2007-02-06 15:41 UTC by Philippe Le Grand
Modified: 2007-05-22 06:12 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 Philippe Le Grand 2007-02-06 15:41:54 UTC
Version:           1.5.2 (using KDE KDE 3.5.5)
Installed from:    Ubuntu Packages
Compiler:          gcc 4.1 stock gcc from Ubuntu packages
OS:                Linux

Openning the file ThubanModel.xmi from the Thuban GIS project causes crashes in recent versions of Umbrello.

The file was created with Umbrello, can be worked on fine on Debian Sarge (package is umbrello_4:3.3.2-3_powerpc.deb), but causes a fatal crash (signal 11 SIGSEGV) upon loading under Debian Etch or Kubuntu  (Dapper and later). No custom packages, just vanilla.

original document can be found on the Thuban svn ( https://scm.wald.intevation.org/svn/thuban/trunk under thuban/Doc/ or via web interface https://wald.intevation.org/plugins/scmsvn/viewcvs.php/trunk/thuban/Doc/ThubanModel.xmi?rev=2347&root=thuban&view=log)


Backtrace:
(no debugging symbols found)
Using host libthread_db library "/lib/tls/i686/cmov/libthread_db.so.1".
(no debugging symbols found)
(no debugging symbols found)
(no debugging symbols found)
(no debugging symbols found)
(no debugging symbols found)
(no debugging symbols found)
(no debugging symbols found)
(no debugging symbols found)
(no debugging symbols found)
(no debugging symbols found)
(no debugging symbols found)
(no debugging symbols found)
(no debugging symbols found)
(no debugging symbols found)
(no debugging symbols found)
(no debugging symbols found)
(no debugging symbols found)
(no debugging symbols found)
(no debugging symbols found)
(no debugging symbols found)
(no debugging symbols found)
(no debugging symbols found)
(no debugging symbols found)
(no debugging symbols found)
[Thread debugging using libthread_db enabled]
[New Thread -1234512208 (LWP 16782)]
(no debugging symbols found)
(no debugging symbols found)
(no debugging symbols found)
(no debugging symbols found)
(no debugging symbols found)
(no debugging symbols found)
(no debugging symbols found)
(no debugging symbols found)
(no debugging symbols found)
(no debugging symbols found)
(no debugging symbols found)
(no debugging symbols found)
(no debugging symbols found)
(no debugging symbols found)
(no debugging symbols found)
(no debugging symbols found)
(no debugging symbols found)
(no debugging symbols found)
(no debugging symbols found)
(no debugging symbols found)
(no debugging symbols found)
(no debugging symbols found)
(no debugging symbols found)
(no debugging symbols found)
(no debugging symbols found)
(no debugging symbols found)
(no debugging symbols found)
(no debugging symbols found)
(no debugging symbols found)
(no debugging symbols found)
(no debugging symbols found)
(no debugging symbols found)
(no debugging symbols found)
(no debugging symbols found)
(no debugging symbols found)
(no debugging symbols found)
(no debugging symbols found)
(no debugging symbols found)
(no debugging symbols found)
(no debugging symbols found)
(no debugging symbols found)
[KCrash handler]
#6  0xb7a7951b in QString::QString () from /usr/lib/libqt-mt.so.3
#7  0x08101e2c in UMLObject::getName ()
#8  0x081c0697 in Object_Factory::makeObjectFromXMI ()
#9  0x081c1c1e in UMLDoc::loadUMLObjectsFromXMI ()
#10 0x081d9e91 in UMLDoc::loadFromXMI ()
#11 0x081cf05a in UMLDoc::openDocument ()
#12 0x081cfcdd in UMLApp::openDocumentFile ()
#13 0x081cfe6f in initDocument ()
#14 0x081d01f0 in main ()
Comment 1 Oliver Kellogg 2007-02-07 21:54:53 UTC
SVN commit 631369 by okellogg:

resolveRef(): If the m_SecondaryId is not found then interpret it as
  the name of the type.
loadFromXMI(): If the stereotype ID is not found by then interpret it as
  the name of the stereotype.
These changes improve the loading of files from previous Umbrello versions.
CCBUG:141279


 M  +14 -11    umlobject.cpp  


--- branches/KDE/3.5/kdesdk/umbrello/umbrello/umlobject.cpp #631368:631369
@@ -414,10 +414,13 @@
         }
     }
     if (m_SecondaryFallback.isEmpty()) {
-        kError() << "UMLObject::resolveRef(" << m_Name
-                  << "): cannot find type with id "
-                  << m_SecondaryId << endl;
-        return false;
+        if (m_SecondaryId.isEmpty()) {
+            kError() << "UMLObject::resolveRef(" << m_Name
+                << "): both m_SecondaryId and m_SecondaryFallback are empty"
+                << endl;
+            return false;
+        }
+        m_SecondaryFallback = m_SecondaryId;
     }
 #ifdef VERBOSE_DEBUGGING
     kDebug() << "UMLObject::resolveRef(" << m_Name 
@@ -435,7 +438,6 @@
         maybeSignalObjectCreated();
         return true;
     }
-    //pDoc->setIsOldFile(true);
     // Work around Object_Factory::createUMLObject()'s incapability
     // of on-the-fly scope creation:
     if (m_SecondaryId.contains("::")) {
@@ -458,8 +460,7 @@
                   << "failed to create a new type for " << m_SecondaryId << endl;
         return false;
     }
-    kDebug() << "UMLObject::resolveRef: Creating new type for "
-    << m_SecondaryId << endl;
+    kDebug() << "UMLObject::resolveRef: Creating new type for " << m_SecondaryId << endl;
     // This is very C++ specific - we rely on  some '*' or
     // '&' to decide it's a ref type. Plus, we don't recognize
     // typedefs of ref types.
@@ -594,12 +595,14 @@
     if (!stereo.isEmpty()) {
         Uml::IDType stereoID = STR2ID(stereo);
         m_pStereotype = umldoc->findStereotypeById(stereoID);
-        if (m_pStereotype)
+        if (m_pStereotype) {
             m_pStereotype->incrRefCount();
-        else
-            kError() << "UMLObject::loadFromXMI(" << m_Name << "): "
+        } else {
+            kDebug() << "UMLObject::loadFromXMI(" << m_Name << "): "
                 << "UMLStereotype " << ID2STR(stereoID)
-                << " not found" << endl;
+                << " not found, creating now." << endl;
+            setStereotype(stereo);
+        }
     }
 
     if( element.hasAttribute("abstract") ) {     // for bkwd compat.
Comment 2 Oliver Kellogg 2007-02-07 21:56:55 UTC
Does not crash with current HEAD of branches/KDE/3.5/kdesdk/umbrello.
Comment 3 Oliver Kellogg 2007-05-22 06:12:03 UTC
SVN commit 667185 by okellogg:

resolveRef(): When m_SecondaryId cannot be resolved and m_SecondaryFallback
is empty then set m_pSecondary to the artificial datatype "undef".
This is somewhat less friendly on loading older Umbrello files but avoids
the creation of bogus objects.
The better way to solve this bug would be to warn the user when he attempts
to delete model objects that are still referenced somewhere in the model
but I'm afraid I cannot implement that right now.
CCBUG:141279
BUG:145709


 M  +1 -0      ChangeLog  
 M  +12 -7     umbrello/umlobject.cpp  


--- branches/KDE/3.5/kdesdk/umbrello/ChangeLog #667184:667185
@@ -1,6 +1,7 @@
 Version 1.5.71
 
 * Bugs/wishes from http://bugs.kde.org:
+* Unstable saves and loads, class names become dirty (145709)
 * Crash on deleting class in list view (145762)
 
 Version 1.5.7
--- branches/KDE/3.5/kdesdk/umbrello/umbrello/umlobject.cpp #667184:667185
@@ -414,16 +414,21 @@
             maybeSignalObjectCreated();
             return true;
         }
-    }
-    if (m_SecondaryFallback.isEmpty()) {
-        if (m_SecondaryId.isEmpty()) {
-            kError() << "UMLObject::resolveRef(" << m_Name
-                << "): both m_SecondaryId and m_SecondaryFallback are empty"
-                << endl;
-            return false;
+        if (m_SecondaryFallback.isEmpty()) {
+            kDebug() << "UMLObject::resolveRef: object with xmi.id=" << m_SecondaryId
+                << " not found, setting to undef" << endl;
+            UMLFolder *datatypes = pDoc->getDatatypeFolder();
+            m_pSecondary = Object_Factory::createUMLObject(Uml::ot_Datatype, "undef", datatypes, false);
+            return true;
         }
         m_SecondaryFallback = m_SecondaryId;
     }
+    if (m_SecondaryFallback.isEmpty()) {
+        kError() << "UMLObject::resolveRef(" << m_Name
+            << "): cannot find type with id "
+            << m_SecondaryId << endl;
+        return false;
+    }
 #ifdef VERBOSE_DEBUGGING
     kDebug() << "UMLObject::resolveRef(" << m_Name
               << "): could not resolve secondary ID " << m_SecondaryId