Bug 149457 - crash on exit after loading XMI file with Advanced Code Generators enabled
Summary: crash on exit after loading XMI file with Advanced Code Generators enabled
Status: RESOLVED FIXED
Alias: None
Product: umbrello
Classification: Applications
Component: general (show other bugs)
Version: unspecified
Platform: Compiled Sources Linux
: NOR crash
Target Milestone: ---
Assignee: Oliver Kellogg
URL:
Keywords:
Depends on:
Blocks:
 
Reported: 2007-09-01 20:20 UTC by Oliver Kellogg
Modified: 2013-11-06 17:35 UTC (History)
0 users

See Also:
Latest Commit:
Version Fixed In: 4.0.0


Attachments
phonon-design-saved-by-trunk-r707383.xmi (302.30 KB, application/octet-stream)
2007-09-01 20:22 UTC, Oliver Kellogg
Details

Note You need to log in before you can comment on or make changes to this bug.
Description Oliver Kellogg 2007-09-01 20:20:40 UTC
Version:           trunk r707383 (using KDE Devel)
Installed from:    Compiled sources

I saved phonon design.xmi and loaded the new file.
Here's what happens on exiting:

==16640== Invalid read of size 4
==16640==    at 0x602CE79: __dynamic_cast (in /usr/lib/libstdc++.so.5.0.7)
==16640==    by 0x820C246: CPPHeaderClassDeclarationBlock::updateContent() (cppheaderclassdeclarationblock.cpp:78)
==16640==    by 0x8320A63: OwnedHierarchicalCodeBlock::syncToParent() (ownedhierarchicalcodeblock.cpp:109)
==16640==    by 0x8320B2F: OwnedHierarchicalCodeBlock::qt_metacall(QMetaObject::Call, int, void**) (ownedhierarchicalcodeblock.moc:66)
==16640==    by 0x820CBBC: CPPHeaderClassDeclarationBlock::qt_metacall(QMetaObject::Call, int, void**) (cppheaderclassdeclarationblock.moc:56)
==16640==    by 0x4172587: QMetaObject::activate(QObject*, int, int, void**) (qobject.cpp:3063)
==16640==    by 0x41727A1: QMetaObject::activate(QObject*, QMetaObject const*, int, void**) (qobject.cpp:3125)
==16640==    by 0x836E3C2: UMLObject::modified() (umlobject.moc:78)
==16640==    by 0x836B180: UMLObject::emitModified() (umlobject.cpp:248)
==16640==    by 0x83493E5: UMLCanvasObject::removeAssociationEnd(UMLAssociation*) (umlcanvasobject.cpp:95)
==16640==    by 0x83494F2: UMLCanvasObject::removeAllAssociationEnds() (umlcanvasobject.cpp:113)
==16640==    by 0x8349846: UMLCanvasObject::removeAllChildObjects() (umlcanvasobject.cpp:136)
==16640==    by 0x8321B80: UMLPackage::removeAllObjects() (package.cpp:166)
==16640==    by 0x8321C16: UMLPackage::removeAllObjects() (package.cpp:172)
==16640==    by 0x8321C16: UMLPackage::removeAllObjects() (package.cpp:172)
==16640==    by 0x8321C16: UMLPackage::removeAllObjects() (package.cpp:172)
==16640==    by 0x834C160: UMLDoc::closeDocument() (umldoc.cpp:286)
==16640==    by 0x833FAEB: UMLApp::queryExit() (uml.cpp:832)
==16640==    by 0x47F0DA7: KMainWindowPrivate::_k_shuttingDown() (kmainwindow.cpp:957)
==16640==    by 0x47F1180: KMainWindow::qt_metacall(QMetaObject::Call, int, void**) (kmainwindow.moc:90)
==16640==    by 0x48252BB: KXmlGuiWindow::qt_metacall(QMetaObject::Call, int, void**) (kxmlguiwindow.moc:92)
==16640==    by 0x83445CC: UMLApp::qt_metacall(QMetaObject::Call, int, void**) (uml.moc:214)
==16640==    by 0x4172587: QMetaObject::activate(QObject*, int, int, void**) (qobject.cpp:3063)
==16640==    by 0x41727A1: QMetaObject::activate(QObject*, QMetaObject const*, int, void**) (qobject.cpp:3125)
==16640==    by 0x4195D5D: QCoreApplication::aboutToQuit() (moc_qcoreapplication.cpp:119)
==16640==    by 0x415E196: QCoreApplication::exec() (qcoreapplication.cpp:733)
==16640==    by 0x56C24B4: QApplication::exec() (qapplication.cpp:3035)
==16640==    by 0x8309231: main (main.cpp:111)
==16640==  Address 0x71CC2A0 is not stack'd, malloc'd or (recently) free'd
Comment 1 Oliver Kellogg 2007-09-01 20:22:35 UTC
Created attachment 21526 [details]
phonon-design-saved-by-trunk-r707383.xmi

XMI file for which the crash-on-exit happens.
Comment 2 Oliver Kellogg 2007-09-02 13:43:56 UTC
Call of reimplementred virtual functions during object construction, as usual :(
See also bug 84739 and bug 126262
Comment 3 Oliver Kellogg 2007-09-02 14:47:14 UTC
SVN commit 707609 by okellogg:

Remove calls to reimplemented virtual functions from within constructors of
 advanced code generator classes.
BUG:149457


 M  +1 -0      ChangeLog.2  
 M  +2 -2      umbrello/classifiercodedocument.h  
 M  +2 -2      umbrello/codeaccessormethod.h  
 M  +6 -4      umbrello/codeclassfield.h  
 M  +8 -8      umbrello/codeclassfielddeclarationblock.h  
 M  +10 -6     umbrello/codedocument.h  
 M  +31 -8     umbrello/codegenerators/codegenfactory.cpp  
 M  +0 -3      umbrello/codegenerators/cppheaderclassdeclarationblock.cpp  
 M  +5 -5      umbrello/codegenerators/cppheaderclassdeclarationblock.h  
 M  +0 -2      umbrello/codegenerators/cppheadercodeaccessormethod.h  
 M  +0 -1      umbrello/codegenerators/cppheadercodeclassfielddeclarationblock.cpp  
 M  +3 -3      umbrello/codegenerators/cppheadercodeclassfielddeclarationblock.h  
 M  +3 -0      umbrello/codegenerators/cppheadercodedocument.cpp  
 M  +2 -2      umbrello/codegenerators/cppheadercodedocument.h  
 M  +0 -4      umbrello/codegenerators/cppheadercodeoperation.cpp  
 M  +2 -2      umbrello/codegenerators/cppheadercodeoperation.h  
 M  +0 -2      umbrello/codegenerators/cppsourcecodeaccessormethod.h  
 M  +0 -1      umbrello/codegenerators/cppsourcecodeclassfielddeclarationblock.cpp  
 M  +3 -3      umbrello/codegenerators/cppsourcecodeclassfielddeclarationblock.h  
 M  +5 -6      umbrello/codegenerators/cppsourcecodedocument.cpp  
 M  +2 -2      umbrello/codegenerators/cppsourcecodedocument.h  
 M  +0 -64     umbrello/codegenerators/cppsourcecodeoperation.cpp  
 M  +0 -2      umbrello/codegenerators/cppsourcecodeoperation.h  
 M  +0 -2      umbrello/codegenerators/dclassdeclarationblock.cpp  
 M  +5 -5      umbrello/codegenerators/dclassdeclarationblock.h  
 M  +1 -0      umbrello/codegenerators/dclassifiercodedocument.cpp  
 M  +2 -2      umbrello/codegenerators/dclassifiercodedocument.h  
 M  +3 -3      umbrello/codegenerators/dcodeaccessormethod.h  
 M  +0 -1      umbrello/codegenerators/dcodeclassfielddeclarationblock.cpp  
 M  +3 -3      umbrello/codegenerators/dcodeclassfielddeclarationblock.h  
 M  +0 -3      umbrello/codegenerators/dcodeoperation.cpp  
 M  +0 -3      umbrello/codegenerators/javaclassdeclarationblock.cpp  
 M  +0 -2      umbrello/codegenerators/javaclassdeclarationblock.h  
 M  +1 -0      umbrello/codegenerators/javaclassifiercodedocument.cpp  
 M  +2 -2      umbrello/codegenerators/javaclassifiercodedocument.h  
 M  +3 -3      umbrello/codegenerators/javacodeaccessormethod.h  
 M  +0 -1      umbrello/codegenerators/javacodeclassfielddeclarationblock.cpp  
 M  +5 -4      umbrello/codegenerators/javacodeclassfielddeclarationblock.h  
 M  +0 -3      umbrello/codegenerators/javacodeoperation.cpp  
 M  +0 -3      umbrello/codegenerators/rubyclassdeclarationblock.cpp  
 M  +7 -14     umbrello/codegenerators/rubyclassdeclarationblock.h  
 M  +1 -0      umbrello/codegenerators/rubyclassifiercodedocument.cpp  
 M  +2 -2      umbrello/codegenerators/rubyclassifiercodedocument.h  
 M  +5 -8      umbrello/codegenerators/rubycodeaccessormethod.h  
 M  +0 -1      umbrello/codegenerators/rubycodeclassfielddeclarationblock.cpp  
 M  +3 -3      umbrello/codegenerators/rubycodeclassfielddeclarationblock.h  
 M  +0 -4      umbrello/codegenerators/rubycodeoperation.cpp  
 M  +7 -7      umbrello/codegenerators/xmlelementcodeblock.h  
 M  +7 -6      umbrello/codemethodblock.h  
 M  +3 -3      umbrello/codeoperation.h  
 M  +2 -2      umbrello/codeparameter.h  
 M  +6 -6      umbrello/ownedcodeblock.h  
 M  +2 -2      umbrello/ownedhierarchicalcodeblock.h  
Comment 4 Oliver Kellogg 2007-09-02 21:10:06 UTC
Nope, still not fixed.
(I had forgot to reenable advanced code generators.)
Comment 5 Oliver Kellogg 2007-09-03 23:22:15 UTC
SVN commit 708118 by okellogg:

UMLDoc::closing(): New. Returns true while closeDocument() executes.
UMLObject::emitModified(): Don't emit modified() if UMLDoc::closing() returns true.
Note that this change only _avoids_ the crash but does not fix the cause which
remains totally obscure to me :( Any help appreciated.
BUG:149457


 M  +1 -3      association.cpp  
 M  +4 -4      classifier.cpp  
 M  +7 -1      umldoc.cpp  
 M  +10 -0     umldoc.h  
 M  +1 -1      umlobject.cpp  


--- trunk/KDE/kdesdk/umbrello/umbrello/association.cpp #708117:708118
@@ -546,9 +546,7 @@
         kDebug() << " A new uni-association has been created.";
 #endif
     }
-    UMLDoc *umldoc = UMLApp::app()->getDocument();
-    if (! umldoc->loading())
-        emit modified();
+    UMLObject::emitModified();
 }
 
 void UMLAssociation::setObject(UMLObject *obj, Uml::Role_Type role) {
--- trunk/KDE/kdesdk/umbrello/umbrello/classifier.cpp #708117:708118
@@ -765,7 +765,7 @@
             UMLAttribute *retval = dynamic_cast<UMLAttribute*>(m_List.takeAt( index ));
             if (retval) {
                 emit attributeRemoved(retval);
-                emit modified();
+                UMLObject::emitModified();
             } else {
                 index = -1;
             }
@@ -775,7 +775,7 @@
             UMLTemplate *t = dynamic_cast<UMLTemplate*>(m_List.takeAt( index));
             if (t) {
                 emit templateRemoved(t);
-                emit modified();
+                UMLObject::emitModified();
             } else {
                 index = -1;
             }
@@ -786,7 +786,7 @@
             if (el) {
                 UMLEnum *e = static_cast<UMLEnum*>(this);
                 e->signalEnumLiteralRemoved(el);
-                emit modified();
+                UMLObject::emitModified();
             } else {
                 index = -1;
             }
@@ -797,7 +797,7 @@
             if (el) {
                 UMLEntity *e = static_cast<UMLEntity*>(this);
                 e->signalEntityAttributeRemoved(el);
-                emit modified();
+                UMLObject::emitModified();
             } else {
                 index = -1;
             }
--- trunk/KDE/kdesdk/umbrello/umbrello/umldoc.cpp #708117:708118
@@ -95,6 +95,7 @@
     m_nViewID = Uml::id_None;
     m_pTabPopupMenu = 0;
     m_pCurrentRoot = NULL;
+    m_bClosing = false;
 }
 
 void UMLDoc::init() {
@@ -257,6 +258,7 @@
 }
 
 void UMLDoc::closeDocument() {
+    m_bClosing = true;
     UMLApp::app()->setGenerator(Uml::pl_Reserved);  // delete the codegen
     m_Doc = "";
     DocWindow* dw = UMLApp::app()->getDocWindow();
@@ -299,6 +301,7 @@
         }
          */
     }
+    m_bClosing = false;
     m_bTypesAreResolved = false;
 }
 
@@ -827,7 +830,6 @@
     }
     s = new UMLStereotype(name, STR2ID(name));
     addStereotype(s);
-    //emit modified();
     return s;
 }
 
@@ -956,6 +958,10 @@
     m_bLoading = state;
 }
 
+bool UMLDoc::closing() const {
+    return m_bClosing;
+}
+
 UMLView* UMLDoc::createDiagram(UMLFolder *folder, Uml::Diagram_Type type, bool askForName /*= true */) {
     bool ok = true;
     QString name,
--- trunk/KDE/kdesdk/umbrello/umbrello/umldoc.h #708117:708118
@@ -701,6 +701,11 @@
     void setLoading(bool state = true);
 
     /**
+     * Returns the m_bClosing flag.
+     */
+    bool closing() const;
+
+    /**
      * Calls the active code generator to create its default datatypes
      */
     void addDefaultDatatypes();
@@ -828,6 +833,11 @@
      */
     UMLFolder * m_pCurrentRoot;
 
+    /**
+     * True while closeDocument() is executing.
+     */
+    bool m_bClosing;
+
 public slots:
 
     void slotRemoveUMLObject(UMLObject*o);
--- trunk/KDE/kdesdk/umbrello/umbrello/umlobject.cpp #708117:708118
@@ -244,7 +244,7 @@
 void UMLObject::emitModified()
 {
     UMLDoc *umldoc = UMLApp::app()->getDocument();
-    if (! umldoc->loading())
+    if (!umldoc->loading() && !umldoc->closing())
         emit modified();
 }
 
Comment 6 Ralf Habacker 2013-11-06 17:35:37 UTC
set version-fixed-in from 4.0.0 changelog