Bug 125331 - crash loading xmi file created by older version
Summary: crash loading xmi file created by older version
Status: RESOLVED DUPLICATE of bug 126262
Alias: None
Product: umbrello
Classification: Applications
Component: general (show other bugs)
Version: 1.5.2
Platform: Fedora RPMs Linux
: NOR crash
Target Milestone: ---
Assignee: Umbrello Development Group
URL:
Keywords:
Depends on:
Blocks:
 
Reported: 2006-04-11 02:36 UTC by Bernie Innocenti
Modified: 2006-05-11 20:19 UTC (History)
0 users

See Also:
Latest Commit:
Version Fixed In:


Attachments
File that crashes umbrello. (457.46 KB, application/octet-stream)
2006-04-11 02:37 UTC, Bernie Innocenti
Details
Fix for crash due to not initialized pointers (1.19 KB, patch)
2006-05-11 17:04 UTC, Daniel Calviño Sánchez
Details

Note You need to log in before you can comment on or make changes to this bug.
Description Bernie Innocenti 2006-04-11 02:36:37 UTC
Version:           1.5.2 (using KDE KDE 3.5.2)
Installed from:    Fedora RPMs
OS:                Linux

Try the attached file.  I get this traceback:

Program received signal SIGSEGV, Segmentation fault.
[Switching to Thread 47263780650432 (LWP 14809)]
0x000000000066dd9b in CPPSourceCodeOperation::updateMethodDeclaration ()
(gdb) bt
#0  0x000000000066dd9b in CPPSourceCodeOperation::updateMethodDeclaration ()
#1  0x000000000066da54 in CPPSourceCodeOperation::init ()
#2  0x000000000066cbf7 in CPPSourceCodeDocument::newCodeOperation ()
#3  0x00000000004f22c6 in ClassifierCodeDocument::updateOperations ()
#4  0x000000000066cd83 in CPPSourceCodeDocument::init ()
#5  0x0000000000669b34 in CPPCodeGenerator::newClassifierCodeDocument ()
#6  0x000000000066a8d4 in CPPCodeGenerator::initFromParentDocument ()
#7  0x0000000000655870 in CodeGeneratorFactory::createObject ()
#8  0x00000000005616d2 in UMLApp::createGenerator ()
#9  0x0000000000561b2c in UMLApp::getGenerator ()
#10 0x000000000056c796 in UMLDoc::addDefaultStereotypes ()
#11 0x00000000005781ef in UMLDoc::openDocument ()
#12 0x00000000005639b9 in UMLApp::openDocumentFile ()
#13 0x00000000005370b5 in main ()
Comment 1 Bernie Innocenti 2006-04-11 02:37:30 UTC
Created attachment 15552 [details]
File that crashes umbrello.
Comment 2 Oliver Kellogg 2006-04-26 07:33:02 UTC
In fact, on checking again they are exactly identical.

*** This bug has been marked as a duplicate of 126262 ***
Comment 3 Oliver Kellogg 2006-05-09 22:03:16 UTC
SVN commit 539143 by okellogg:

Contrary to my assertion in Comment #2, this turns out not to be
the same as bug 126262. But at least this XMI loads now.
CCBUG:125331


 M  +9 -8      classifiercodedocument.cpp  
 M  +3 -1      classifiercodedocument.h  
 M  +3 -5      codeclassfield.cpp  
 M  +0 -5      codeclassfield.h  
 M  +37 -67    codedocument.cpp  
 M  +8 -49     codedocument.h  
 M  +44 -8     codegenerationpolicy.cpp  
 M  +43 -29    codegenerationpolicy.h  
 M  +49 -81    codegenerator.cpp  
 M  +17 -43    codegenerator.h  
 M  +1 -1      codegenerators/Makefile.am  
 M  +1 -0      codegenerators/codegenfactory.cpp  
 M  +5 -3      codegenerators/cppcodeclassfield.cpp  
 M  +6 -7      codegenerators/cppcodedocumentation.cpp  
 M  +2 -2      codegenerators/cppcodedocumentation.h  
 M  +18 -52    codegenerators/cppcodegenerationpolicy.cpp  
 M  +3 -4      codegenerators/cppcodegenerationpolicy.h  
 M  +11 -6     codegenerators/cppcodegenerationpolicypage.cpp  
 M  +16 -26    codegenerators/cppcodegenerator.cpp  
 M  +5 -20     codegenerators/cppcodegenerator.h  
 M  +8 -6      codegenerators/cppheaderclassdeclarationblock.cpp  
 M  +9 -5      codegenerators/cppheadercodeaccessormethod.cpp  
 M  +47 -62    codegenerators/cppheadercodedocument.cpp  
 M  +3 -9      codegenerators/cppheadercodedocument.h  
 M  +22 -24    codegenerators/cppheadercodeoperation.cpp  
 M  +2 -5      codegenerators/cppheadercodeoperation.h  
 M  +3 -2      codegenerators/cppmakecodedocument.cpp  
 M  +3 -4      codegenerators/cppmakecodedocument.h  
 M  +9 -6      codegenerators/cppsourcecodeaccessormethod.cpp  
 M  +15 -17    codegenerators/cppsourcecodedocument.cpp  
 M  +3 -6      codegenerators/cppsourcecodedocument.h  
 M  +81 -22    codegenerators/cppsourcecodeoperation.cpp  
 M  +2 -5      codegenerators/cppsourcecodeoperation.h  
 M  +6 -5      codegenerators/javaantcodedocument.cpp  
 M  +3 -3      codegenerators/javaantcodedocument.h  
 M  +8 -4      codegenerators/javaclassdeclarationblock.cpp  
 M  +23 -20    codegenerators/javaclassifiercodedocument.cpp  
 M  +3 -3      codegenerators/javaclassifiercodedocument.h  
 M  +11 -11    codegenerators/javacodeaccessormethod.cpp  
 M  +5 -4      codegenerators/javacodeclassfield.cpp  
 M  +6 -6      codegenerators/javacodeclassfielddeclarationblock.cpp  
 M  +9 -7      codegenerators/javacodedocumentation.cpp  
 M  +13 -55    codegenerators/javacodegenerationpolicy.cpp  
 M  +5 -21     codegenerators/javacodegenerationpolicy.h  
 M  +17 -14    codegenerators/javacodegenerationpolicypage.cpp  
 M  +8 -30     codegenerators/javacodegenerator.cpp  
 M  +5 -29     codegenerators/javacodegenerator.h  
 M  +13 -19    codegenerators/javacodeoperation.cpp  
 M  +2 -5      codegenerators/javacodeoperation.h  
 A             codegenerators/ncgof.cpp   [License: no copyright]
 A             codegenerators/ncgof.h   [License: GPL (v2+)]
 M  +10 -7     codegenerators/rubyclassdeclarationblock.cpp  
 M  +28 -28    codegenerators/rubyclassifiercodedocument.cpp  
 M  +10 -13    codegenerators/rubycodeaccessormethod.cpp  
 M  +5 -3      codegenerators/rubycodeclassfield.cpp  
 M  +6 -7      codegenerators/rubycodeclassfielddeclarationblock.cpp  
 M  +8 -5      codegenerators/rubycodedocumentation.cpp  
 M  +8 -57     codegenerators/rubycodegenerationpolicy.cpp  
 M  +4 -20     codegenerators/rubycodegenerationpolicy.h  
 M  +13 -10    codegenerators/rubycodegenerationpolicypage.cpp  
 M  +4 -25     codegenerators/rubycodegenerator.cpp  
 M  +3 -28     codegenerators/rubycodegenerator.h  
 M  +18 -22    codegenerators/rubycodeoperation.cpp  
 M  +0 -4      codegenerators/rubycodeoperation.h  
 M  +4 -2      codegenerators/simplecodegenerator.cpp  
 M  +30 -25    codegenobjectwithtextblocks.cpp  
 M  +21 -25    codegenobjectwithtextblocks.h  
 M  +7 -4      codemethodblock.cpp  
 M  +4 -3      codeoperation.cpp  
 M  +4 -7      codeparameter.cpp  
 M  +2 -5      codeparameter.h  
 M  +20 -41    dialogs/codegenerationoptionspage.cpp  
 M  +10 -9     dialogs/codegenerationoptionspage.h  
 M  +2 -0      dialogs/codegenerationpolicypage.h  
 M  +11 -11    dialogs/codegenerationwizard.cpp  
 M  +3 -3      dialogs/codegenerationwizard.h  
 M  +4 -9      dialogs/settingsdlg.cpp  
 M  +4 -6      dialogs/settingsdlg.h  
 M  +11 -17    hierarchicalcodeblock.cpp  
 M  +2 -10     hierarchicalcodeblock.h  
 M  +1 -1      main.cpp  
 M  +4 -1      model_utils.cpp  
 M  +2 -2      object_factory.cpp  
 M  +4 -2      ownedcodeblock.cpp  
 M  +5 -5      textblock.cpp  
 M  +86 -163   uml.cpp  
 M  +42 -11    uml.h  
 M  +13 -73    umldoc.cpp  
 M  +2 -50     umldoc.h  
 M  +1 -1      umlwidget.cpp  
Comment 4 Daniel Calviño Sánchez 2006-05-10 13:11:54 UTC
In commit 539143, file dialogs/codegenerationoptionspage.cpp includes "../codegenerators/codegenpolicyext.h". However, this file doesn't exist in SVN, so Umbrello doesn't compile.
Comment 5 Oliver Kellogg 2006-05-10 20:32:48 UTC
SVN commit 539454 by okellogg:

Add file forgotten in commit 539143 - again many thanks to Daniel
for his alertness :)
CCBUG:125331


 A             codegenpolicyext.h   [License: GPL (v2+)]
Comment 6 Daniel Calviño Sánchez 2006-05-11 17:04:36 UTC
Created attachment 16028 [details]
Fix for crash due to not initialized pointers

As m_policyext wasn't set to NULL in constructor, Umbrello crashed under
certain circumstances (because as it wasn't NULL it passed guarded conditions,
but it wasn't initialized, so the pointer was invalid).

A new guarded condition was added for a CodeGenerator pointer used in
umldoc.cpp to avoid crashes due to NULL pointer.
Comment 7 Oliver Kellogg 2006-05-11 20:19:06 UTC
SVN commit 539791 by okellogg:

Attachment 16028 [details] from Daniel Calviño Sánchez adds initialization of
UMLApp::m_policyext and check for NULL codegen pointer in UMLDoc::saveToXMI().
CCBUG:125331


 M  +1 -0      uml.cpp  
 M  +6 -5      umldoc.cpp  


--- branches/KDE/3.5/kdesdk/umbrello/umbrello/uml.cpp #539790:539791
@@ -88,6 +88,7 @@
     m_clipTimer = 0;
     m_copyTimer = 0;
     m_codegen = 0;
+    m_policyext = 0;
     m_commoncodegenpolicy = 0;
     m_activeLanguage = Uml::pl_Reserved;
     ///////////////////////////////////////////////////////////////////
--- branches/KDE/3.5/kdesdk/umbrello/umbrello/umldoc.cpp #539790:539791
@@ -1482,12 +1482,13 @@
     //  save listview
     UMLApp::app()->getListView()->saveToXMI( doc, extensions, saveSubmodelFiles );
 
-    // save code generators
-    QDomElement codeGenElement = doc.createElement( "codegeneration" );
-    
+    // save code generator
     CodeGenerator *codegen = UMLApp::app()->getGenerator();
-    codegen->saveToXMI( doc, codeGenElement );
-    extensions.appendChild( codeGenElement );
+    if (codegen) {
+        QDomElement codeGenElement = doc.createElement( "codegeneration" );
+        codegen->saveToXMI( doc, codeGenElement );
+        extensions.appendChild( codeGenElement );
+    }
 
     root.appendChild( extensions );