From: asl Date: Fri, 10 Nov 2017 10:01:30 +0000 (+0300) Subject: refs #1393: patch for crash X-Git-Tag: v2.1~34^2 X-Git-Url: http://git.salome-platform.org/gitweb/?a=commitdiff_plain;h=c87fdc84b6cfdf95700cfdc0143f32a829f05087;p=modules%2Fhydro.git refs #1393: patch for crash --- diff --git a/src/HYDROGUI/HYDROGUI_Overview.cxx b/src/HYDROGUI/HYDROGUI_Overview.cxx index 3f34cf17..7a6c1897 100644 --- a/src/HYDROGUI/HYDROGUI_Overview.cxx +++ b/src/HYDROGUI/HYDROGUI_Overview.cxx @@ -315,14 +315,18 @@ void HYDROGUI_Overview::setMainView( OCCViewer_ViewFrame* theMainView ) if( !myViewPort ) { myViewPort = new OCCViewer_ViewPort3d( this, myMainView->getViewPort()->getViewer(), V3d_ORTHOGRAPHIC ); - myViewPort->setBackgroundColor( myMainView->getViewPort()->backgroundColor() ); - connect( myViewPort, SIGNAL( vpMouseEvent( QMouseEvent* ) ), - this, SLOT( OnMouseEvent( QMouseEvent* ) ) ); - connect( myViewPort, SIGNAL( vpResizeEvent( QResizeEvent* ) ), - this, SLOT( OnResizeEvent( QResizeEvent* ) ) ); + if( myViewPort ) + { + myViewPort->setBackgroundColor( myMainView->getViewPort()->backgroundColor() ); + + connect( myViewPort, SIGNAL( vpMouseEvent( QMouseEvent* ) ), + this, SLOT( OnMouseEvent( QMouseEvent* ) ) ); + connect( myViewPort, SIGNAL( vpResizeEvent( QResizeEvent* ) ), + this, SLOT( OnResizeEvent( QResizeEvent* ) ) ); - myLayout->addWidget( myViewPort, 0, 0 ); + myLayout->addWidget( myViewPort, 0, 0 ); + } } #if defined(TEST_MODE) || defined(_DEBUG) @@ -343,6 +347,9 @@ void HYDROGUI_Overview::setMainView( OCCViewer_ViewFrame* theMainView ) void HYDROGUI_Overview::setTopView() { + if( !myViewPort ) + return; + Handle(V3d_View) aView3d = myViewPort->getView(); if( !aView3d.IsNull() ) aView3d->SetProj( V3d_Zpos ); @@ -361,7 +368,7 @@ void HYDROGUI_Overview::setTopView() void HYDROGUI_Overview::OnTransformationAfterOp( OCCViewer_ViewWindow::OperationType theOp ) { - if( theOp>=OCCViewer_ViewWindow::WINDOWFIT ) + if( myViewPort && theOp>=OCCViewer_ViewWindow::WINDOWFIT ) { myViewPort->fitAll(); } @@ -376,6 +383,9 @@ void HYDROGUI_Overview::OnTransformation() QPoint HYDROGUI_Overview::fromMain( int xp, int yp ) const { + if( !myMainView || !myViewPort ) + return QPoint(); + const double EPS = 1E-2; Handle(V3d_View) aMain = myMainView->getViewPort()->getView();