[Uml-devel] kdesdk/umbrello/umbrello

Sebastian Stein seb.kde at hpfsc.de
Wed Jul 14 02:55:10 UTC 2004


CVS commit by sstein: 

Fix by Achim Spangler:

First delete explicitly all widgets in the destructor of the containing
UMLView.
Then delete the QCanvas.

Speed this process - hopefully - by explicit deactivation of signal handling
==> avoid needless display/layout update activities for each deleted widget
 ( QObject::blockSignals( true ) ):
+ during UMLView::removeAllWidgets() ( reactivate signals afterwards )
+ during UMLView::~UMLView()


  M +16 -6     umlview.cpp   1.158


--- kdesdk/umbrello/umbrello/umlview.cpp  #1.157:1.158
@@ -173,10 +173,4 @@ void UMLView::init() {
 ////////////////////////////////////////////////////////////////////////////////////////////////////
 UMLView::~UMLView() {
-        if ( canvas() != NULL ) {
-                // Qt Doc for QCanvasView::~QCanvasView () states:
-                // "Destroys the canvas view. The associated canvas is not deleted."
-                // we should do it now
-                delete canvas();
-        }
         if(m_pIDChangesLog) {
                 delete    m_pIDChangesLog;
@@ -190,4 +184,20 @@ UMLView::~UMLView() {
         }
         //m_SelectionRect.clear();
+
+        // before we can delete the QCanvas, all widgets must be explicitly
+        // removed
+        // otherwise the implicit remove of the contained widgets will cause
+        // events which would demand a valid connected QCanvas
+        // ==> this causes umbrello to crash for some - larger?? - projects
+        // first avoid all events, which would cause some update actions
+        // on deletion of each removed widget
+        blockSignals( true );
+        removeAllWidgets();
+        if ( canvas() != NULL ) {
+                // Qt Doc for QCanvasView::~QCanvasView () states:
+                // "Destroys the canvas view. The associated canvas is not deleted."
+                // we should do it now
+                delete canvas();
+        }
 }
 






More information about the umbrello-devel mailing list