From: sln Date: Mon, 25 Apr 2011 10:31:36 +0000 (+0000) Subject: Sometimes when base widget of QtxWorkstackChild is removed it nullifies myWidget... X-Git-Tag: DIAGRAM_1_0~14 X-Git-Url: http://git.salome-platform.org/gitweb/?a=commitdiff_plain;h=3bb47e5beb5d7e1b15ee405e597489cdbefa79c5;p=modules%2Fgui.git Sometimes when base widget of QtxWorkstackChild is removed it nullifies myWidget field by deleted widget remains in layout. As result if QtxWorkstackChild with removed base widget is activated QT base level asks its size hint. This leads to segmentation fault. Now protection is provided. If QtxWorkstackChild receives event about deletion of its base widget it removes it clears its layout. Also all processEvents() emthods call are commented in DiagramGUI_Module. --- diff --git a/src/Qtx/QtxWorkstack.cxx b/src/Qtx/QtxWorkstack.cxx index 566b2953f..5ad12139c 100644 --- a/src/Qtx/QtxWorkstack.cxx +++ b/src/Qtx/QtxWorkstack.cxx @@ -1236,7 +1236,15 @@ void QtxWorkstackChild::onDestroyed( QObject* obj ) { if ( obj != widget() ) return; - + + QLayout* lay = layout(); + if ( lay ) + { + QLayoutItem* item = lay->takeAt( 0 ); + if ( item ) + lay->removeItem( item ); + } + myWidget = 0; deleteLater(); } @@ -1249,6 +1257,14 @@ void QtxWorkstackChild::childEvent( QChildEvent* e ) { if ( e->removed() && e->child() == widget() ) { + QLayout* lay = layout(); + if ( lay ) + { + QLayoutItem* item = lay->takeAt( 0 ); + if ( item ) + lay->removeItem( item ); + } + myWidget = 0; deleteLater(); }