Bug 85122 - Crash loading simple xmi file with associations
Summary: Crash loading simple xmi file with associations
Status: RESOLVED NOT A BUG
Alias: None
Product: umbrello
Classification: Applications
Component: general (show other bugs)
Version: unspecified
Platform: unspecified Linux
: NOR crash
Target Milestone: ---
Assignee: Umbrello Development Group
URL:
Keywords:
Depends on:
Blocks:
 
Reported: 2004-07-13 22:40 UTC by Sebastian Stein
Modified: 2004-07-14 11:32 UTC (History)
0 users

See Also:
Latest Commit:
Version Fixed In:


Attachments
compressed xmi file (5.45 KB, application/octet-stream)
2004-07-13 22:42 UTC, Sebastian Stein
Details

Note You need to log in before you can comment on or make changes to this bug.
Description Sebastian Stein 2004-07-13 22:40:45 UTC
Version:           1.2.92 (using KDE 3.2.3, compiled sources)
Compiler:          gcc version 3.3.3
OS:                Linux (i686) release 2.4.26

Ok, what can I tell you about this bug... Try loading the attached file (on startup) and Umbrello will crash. Valgrind says (with Umbrello output between):

umbrello: Looking up generator for language XMLSchema
umbrello:  A new uni-association has been created.
umbrello: UMLWidget::loadFromXMI(id=10): m_pObject is already set (new_class)
umbrello: UMLWidget::loadFromXMI(id=11): m_pObject is already set (new_class_1)
umbrello: WARNING: Show Event for class diagram
umbrello: AssociationWidget::widgetMoved() called during load of XMI
umbrello: AssociationWidget::widgetMoved() called during load of XMI
umbrello: AssociationWidget::widgetMoved() called during load of XMI
umbrello: AssociationWidget::widgetMoved() called during load of XMI
umbrello: CodeGeneratorFactory created
umbrello: Looking up generator for language Cpp
umbrello: WARNING:  loadFromXMI: missing code document w/ id:2, plowing ahead with pre-generated one.
umbrello: WARNING:  loadFromXMI: missing code document w/ id:3, plowing ahead with pre-generated one.
umbrello: WARNING:  loadFromXMI: missing code document w/ id:4, plowing ahead with pre-generated one.
umbrello: WARNING:  loadFromXMI: missing code document w/ id:5, plowing ahead with pre-generated one.
umbrello: WARNING:  loadFromXMI: missing code document w/ id:6, plowing ahead with pre-generated one.
umbrello: WARNING:  loadFromXMI: missing code document w/ id:7, plowing ahead with pre-generated one.
umbrello: WARNING:  loadFromXMI: missing code document w/ id:8, plowing ahead with pre-generated one.
umbrello: WARNING:  loadFromXMI: missing code document w/ id:9, plowing ahead with pre-generated one.
umbrello: ERROR: Failed to find codeclassfield for parent uml id:12 (role id:1) Do you have a corrupt classifier code document?
umbrello: ERROR:  LoadFromXMI: can't load classfield parent_id:12 do you have a corrupt savefile?
==3538==
==3538== Invalid read of size 4
==3538==    at 0x3D430D7B: __dynamic_cast (in /usr/lib/libstdc++.so.5.0.6)
==3538==    by 0x81196F1: CodeGenObjectWithTextBlocks::findParentObjectForTaggedTextBlock(QString const&) (codegenobjectwithtextblocks.cpp:175)
==3538==    by 0x8119153: CodeGenObjectWithTextBlocks::addTextBlock(TextBlock*) (codegenobjectwithtextblocks.cpp:86)
==3538==    by 0x811A904: CodeGenObjectWithTextBlocks::loadChildTextBlocksFromNode(QDomElement&) (codegenobjectwithtextblocks.cpp:473)
==3538==  Address 0x3DAAA2FC is 0 bytes inside a block of size 76 free'd
==3538==    at 0x3C01D9C5: operator delete(void*) (vg_replace_malloc.c:129)
==3538==    by 0x811A29F: CodeGenObjectWithTextBlocks::loadChildTextBlocksFromNode(QDomElement&) (codegenobjectwithtextblocks.cpp:479)
==3538==    by 0x8119F4B: CodeGenObjectWithTextBlocks::setAttributesFromNode(QDomElement&) (codegenobjectwithtextblocks.cpp:386)
==3538==    by 0x8111EB6: CodeDocument::setAttributesFromNode(QDomElement&) (codedocument.cpp:434)
umbrello: ERROR: Failed to find codeclassfield for parent uml id:12 (role id:0) Do you have a corrupt classifier code document?
umbrello: ERROR:  LoadFromXMI: can't load classfield parent_id:12 do you have a corrupt savefile?
umbrello: WARNING:  loadFromXMI: missing code document w/ id:cppheader2, plowing ahead with pre-generated one.
umbrello: WARNING:  loadFromXMI: missing code document w/ id:cppheader3, plowing ahead with pre-generated one.
umbrello: WARNING:  loadFromXMI: missing code document w/ id:cppheader4, plowing ahead with pre-generated one.
umbrello: WARNING:  loadFromXMI: missing code document w/ id:cppheader5, plowing ahead with pre-generated one.
umbrello: WARNING:  loadFromXMI: missing code document w/ id:cppheader6, plowing ahead with pre-generated one.
umbrello: WARNING:  loadFromXMI: missing code document w/ id:cppheader7, plowing ahead with pre-generated one.
umbrello: WARNING:  loadFromXMI: missing code document w/ id:cppheader8, plowing ahead with pre-generated one.
umbrello: WARNING:  loadFromXMI: missing code document w/ id:cppheader9, plowing ahead with pre-generated one.
umbrello: ERROR: Failed to find codeclassfield for parent uml id:12 (role id:1) Do you have a corrupt classifier code document?
umbrello: ERROR:  LoadFromXMI: can't load classfield parent_id:12 do you have a corrupt savefile?
==3538==
==3538== Invalid read of size 4
==3538==    at 0x3D430D7B: __dynamic_cast (in /usr/lib/libstdc++.so.5.0.6)
==3538==    by 0x81196F1: CodeGenObjectWithTextBlocks::findParentObjectForTaggedTextBlock(QString const&) (codegenobjectwithtextblocks.cpp:175)
==3538==    by 0x8119153: CodeGenObjectWithTextBlocks::addTextBlock(TextBlock*) (codegenobjectwithtextblocks.cpp:86)
==3538==    by 0x8262FC1: CPPHeaderCodeDocument::loadChildTextBlocksFromNode(QDomElement&) (cppheadercodedocument.cpp:147)
==3538==  Address 0x3DFF38A8 is 0 bytes inside a block of size 76 free'd
==3538==    at 0x3C01D9C5: operator delete(void*) (vg_replace_malloc.c:129)
==3538==    by 0x8262B1F: CPPHeaderCodeDocument::loadChildTextBlocksFromNode(QDomElement&) (cppheadercodedocument.cpp:206)
==3538==    by 0x8119F4B: CodeGenObjectWithTextBlocks::setAttributesFromNode(QDomElement&) (codegenobjectwithtextblocks.cpp:386)
==3538==    by 0x8111EB6: CodeDocument::setAttributesFromNode(QDomElement&) (codedocument.cpp:434)
==3538==
==3538== Invalid read of size 4
==3538==    at 0x3D430D7B: __dynamic_cast (in /usr/lib/libstdc++.so.5.0.6)
==3538==    by 0x81196F1: CodeGenObjectWithTextBlocks::findParentObjectForTaggedTextBlock(QString const&) (codegenobjectwithtextblocks.cpp:175)
==3538==    by 0x8119153: CodeGenObjectWithTextBlocks::addTextBlock(TextBlock*) (codegenobjectwithtextblocks.cpp:86)
==3538==    by 0x812ACF8: HierarchicalCodeBlock::addTextBlock(TextBlock*) (hierarchicalcodeblock.cpp:126)

Well, the interesting is, that the problem happens in ClassifierCodeDocument::findCodeClassFieldFromParentID; This function checks first, if to search attribute-based or association(role)-based. role_id==-1, so association(role)-based wins. But the loop is never entered, because at this moment the m_classfieldVector is still empty. So that's where the problem starts...

Ok, we also have a backtrace:

Program received signal SIGSEGV, Segmentation fault.
0x41421d7f in __dynamic_cast () from /usr/lib/./libstdc++.so.5
(gdb) bt
#0  0x41421d7f in __dynamic_cast () from /usr/lib/./libstdc++.so.5
#1  0x08119a82 in CodeGenObjectWithTextBlocks::findParentObjectForTaggedTextBlock (this=0x84b73a8, tag=@0xbfffeca0) at codegenobjectwithtextblocks.cpp:175
#2  0x081194e4 in CodeGenObjectWithTextBlocks::addTextBlock (this=0x84b73a8,
    add_object=0x84bade0) at codegenobjectwithtextblocks.cpp:86
#3  0x0811ac95 in CodeGenObjectWithTextBlocks::loadChildTextBlocksFromNode (
    this=0x84b73a8, root=@0x6f0043) at codegenobjectwithtextblocks.cpp:473
#4  0x0811a2dc in CodeGenObjectWithTextBlocks::setAttributesFromNode (
    this=0x84b73a8, root=@0xbffff0d0) at codegenobjectwithtextblocks.cpp:386
#5  0x08112247 in CodeDocument::setAttributesFromNode (this=0x84b7380,
    root=@0xbffff0d0) at codedocument.cpp:434
#6  0x08103be3 in ClassifierCodeDocument::setAttributesFromNode (
    this=0x84b7380, elem=@0xbffff0d0) at classifiercodedocument.cpp:552
#7  0x081049e6 in ClassifierCodeDocument::loadFromXMI (this=0x6f0043,
    root=@0xbffff0d0) at classifiercodedocument.cpp:639
#8  0x08115cf8 in CodeGenerator::loadFromXMI (this=0x840dcc8,
    qElement=@0xbffff1a0) at codegenerator.cpp:230
#9  0x0815d8a6 in UMLApp::createGenerator (this=0x83e28d8) at uml.cpp:1177
#10 0x0815ee69 in UMLApp::initSavedCodeGenerators (this=0x83e28d8)
    at uml.cpp:1441
#11 0x08159863 in UMLApp::openDocumentFile (this=0x83e28d8, url=@0x1)
    at uml.cpp:412
#12 0x0813e709 in main (argc=1, argv=0xbffff474) at main.cpp:77

But I don't think it is really interesting. Hope someone knowing the complete loading stuff can fix this... Please also keep in mind, that maybe the xmi file is corrupted. Then there is a problem during saving. You can recreate the file with the following steps:

1. create 2 classes
2. add an association to between the classes
3. set role names and multiplicity to this association
4. save file
5. close Umbrello and restart -> Crash
Comment 1 Sebastian Stein 2004-07-13 22:42:29 UTC
Created attachment 6665 [details]
compressed xmi file

While loading this file Umbrello crashes at startup. If you start Umbrello and
load this file, it may not crash. But at least at Umbrello shutdown it will
crash.
Comment 2 Sebastian Stein 2004-07-14 11:32:38 UTC
This bug was introduced by my leak fixes. I have reverted the changes, now the file is loading fine.