[Uml-devel] KDE/kdesdk/umbrello/umbrello

Oliver Kellogg okellogg at users.sourceforge.net
Mon Sep 3 21:22:11 UTC 2007


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();
 }
 




More information about the umbrello-devel mailing list