From: isn Date: Fri, 5 Apr 2019 16:24:05 +0000 (+0300) Subject: crash on exit (hydro module -> close) X-Git-Tag: SH_V2_2_0~99^2~25^2~1 X-Git-Url: http://git.salome-platform.org/gitweb/?a=commitdiff_plain;h=579de874d9174e108a5bab6cfe7a7223d5f3a35a;p=modules%2Fhydro.git crash on exit (hydro module -> close) --- diff --git a/src/HYDROGUI/HYDROGUI_Overview.cxx b/src/HYDROGUI/HYDROGUI_Overview.cxx index 15377580..4b15a6b1 100644 --- a/src/HYDROGUI/HYDROGUI_Overview.cxx +++ b/src/HYDROGUI/HYDROGUI_Overview.cxx @@ -309,7 +309,12 @@ QImage HYDROGUI_Overview::dump() const OCCViewer_ViewPort3d* HYDROGUI_Overview::getViewPort( bool isMain ) const { - return isMain ? myMainView->getViewPort() : myViewPort; + if ( isMain) + { + myMainView ? myMainView->getViewPort() : NULL; + } + else + return myViewPort; } void HYDROGUI_Overview::setMainView( OCCViewer_ViewFrame* theMainView ) @@ -324,7 +329,9 @@ void HYDROGUI_Overview::setMainView( OCCViewer_ViewFrame* theMainView ) connect( aMainView->getViewPort(), SIGNAL( vpResizeEvent( QResizeEvent* ) ), this, SLOT( OnResizeEvent( QResizeEvent* ) ) ); connect( aMainView->getViewPort(), SIGNAL( vpTransformed( OCCViewer_ViewPort* ) ), - this, SLOT( OnTransformation() ) ); + this, SLOT( OnTransformation() ) ); + + connect( myMainView, SIGNAL(destroyed()), this, SLOT( onMainViewDestr() ) ); if( !myViewPort ) { @@ -477,6 +484,19 @@ void HYDROGUI_Overview::OnResizeEvent( QResizeEvent* ) myBand->update( true ); } + +void HYDROGUI_Overview::onMainViewDestr() +{ + myMainView = NULL; + if (myViewPort == NULL) + return; + Handle(V3d_View) ov = myViewPort->getView(); + ov->View()->Deactivate(); + delete myViewPort; + myViewPort = NULL; +} + + void HYDROGUI_Overview::CustomFitSelection() const { OCCViewer_ViewPort3d* main = getViewPort( true ); diff --git a/src/HYDROGUI/HYDROGUI_Overview.h b/src/HYDROGUI/HYDROGUI_Overview.h index 6ab94a4b..36a1a2d7 100644 --- a/src/HYDROGUI/HYDROGUI_Overview.h +++ b/src/HYDROGUI/HYDROGUI_Overview.h @@ -57,6 +57,7 @@ private slots: void OnTransformation(); void OnMouseEvent( QMouseEvent* ); void OnResizeEvent( QResizeEvent* ); + void onMainViewDestr(); private: QGridLayout* myLayout;