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

Oliver Kellogg okellogg at users.sourceforge.net
Thu Dec 21 07:33:58 UTC 2006


SVN commit 615332 by okellogg:

removeAllViews(): Set current view to NULL. UMLApp::setDiagramMenuItemsState()
calls UMLApp::getCurrentView() which would yield invalid memory (the current
view was deleted.) valgrind be thanked.


 M  +2 -1      umldoc.cpp  


--- branches/KDE/3.5/kdesdk/umbrello/umbrello/umldoc.cpp #615331:615332
@@ -1122,7 +1122,7 @@
         return m_root[Uml::mt_Logical];
     }
     UMLFolder *f = currentView->getFolder();
-    while (f->getUMLPackage()) {
+    while (f) {
         f = static_cast<UMLFolder*>(f->getUMLPackage());
     }
     return f;
@@ -1836,6 +1836,7 @@
 void UMLDoc::removeAllViews() {
     for (int i = 0; i < Uml::N_MODELTYPES; i++)
         m_root[i]->removeAllViews();
+    UMLApp::app()->setCurrentView(NULL);
     emit sigDiagramChanged(dt_Undefined);
     UMLApp::app()->setDiagramMenuItemsState(false);
 }




More information about the umbrello-devel mailing list