]> SALOME platform Git repositories - modules/hydro.git/blobdiff - src/HYDROGUI/HYDROGUI_ImportImageOp.cxx
Salome HOME
Name validator is added to the Calculation Case dialog.
[modules/hydro.git] / src / HYDROGUI / HYDROGUI_ImportImageOp.cxx
index 6db630212db27aff3c2232f8e92191543b4839d5..dabeaad10cc3f0a3c3b3b2f484b93fbb96cde800 100644 (file)
@@ -496,7 +496,7 @@ void HYDROGUI_ImportImageOp::onRefImageActivated( const QString& theName )
       {
         aViewPort = aViewer->getActiveViewPort();
         connect( aViewer, SIGNAL( selectionChanged( GV_SelectionChangeStatus ) ),
-                 this, SLOT( onPointSelected() ) );
+                 this, SLOT( onRefPointSelected() ) );
       }
     }
   }
@@ -564,6 +564,11 @@ void HYDROGUI_ImportImageOp::onPointSelected()
   onPointSelected( myRefPreviewPrs && myRefPreviewPrs->isSelected() );
 }
 
+void HYDROGUI_ImportImageOp::onRefPointSelected()
+{
+  onPointSelected( true );
+}
+
 void HYDROGUI_ImportImageOp::onPointSelected( bool theIsRefImage )
 {
   HYDROGUI_PrsImage* aPrs = theIsRefImage ? myRefPreviewPrs : myPreviewPrs;
@@ -599,32 +604,37 @@ void HYDROGUI_ImportImageOp::closePreview()
 
 void HYDROGUI_ImportImageOp::closeView( GraphicsView_ViewManager* &aViewMgr )
 {
-  // It's very strange, but without calling this method (it's quite safe) a crash is stably reproduced.
-  // Scenario: create any non-Graphics view, activate import op, click apply.
-  // Result: a few SIGSEGVs coming from processEvents(), then crash.
   if( aViewMgr )
   {
+    GraphicsView_ViewPort* aViewPort = 0;
     if( GraphicsView_Viewer* aViewer = aViewMgr->getViewer() )
     {
-      if( GraphicsView_ViewPort* aViewPort = aViewer->getActiveViewPort() )
-      {
-        aViewPort->onBoundingRectChanged();
-      }
+      aViewPort = aViewer->getActiveViewPort();
     }
     disconnect( aViewMgr, SIGNAL( lastViewClosed( SUIT_ViewManager* ) ),
                 this, SLOT( onLastViewClosed( SUIT_ViewManager* ) ) );
 
     // Nullify appropriate presentation pointer
+    HYDROGUI_PrsImage* aPrs;
     switch ( module()->getViewManagerRole( aViewMgr ) )
     {
       case HYDROGUI_Module::VMR_ReferenceImage:
+        aPrs = myRefPreviewPrs;
         myRefPreviewPrs = 0;
         break;
       case HYDROGUI_Module::VMR_TransformImage:
+        aPrs = myPreviewPrs;
         myPreviewPrs = 0;
     }
 
-    // Delete the view and all its presentations
+    // Remove the appropriate presentation from the view
+    if( aPrs && aViewPort )
+    {
+      aViewPort->removeItem( aPrs );
+      delete aPrs;
+    }
+
+    // Delete the view
     module()->getApp()->removeViewManager( aViewMgr ); // aViewMgr is deleted here
     aViewMgr = 0;
   }