]> SALOME platform Git repositories - modules/hydro.git/commitdiff
Salome HOME
crash on exit (hydro module -> close)
authorisn <isn@opencascade.com>
Fri, 5 Apr 2019 16:24:05 +0000 (19:24 +0300)
committerisn <isn@opencascade.com>
Fri, 5 Apr 2019 17:42:57 +0000 (20:42 +0300)
src/HYDROGUI/HYDROGUI_Overview.cxx
src/HYDROGUI/HYDROGUI_Overview.h

index 1537758044c50434c17c827a9273c95f584d386f..4b15a6b16d656deaedd72ec49bc4451ccb692102 100644 (file)
@@ -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 );
index 6ab94a4b231260712735e01bb5be7e8642603aa5..36a1a2d7b0dfb392041d07c11079d359ad2d0401 100644 (file)
@@ -57,6 +57,7 @@ private slots:
   void OnTransformation();
   void OnMouseEvent( QMouseEvent* );
   void OnResizeEvent( QResizeEvent* );
+  void onMainViewDestr();
 
 private:
   QGridLayout*           myLayout;