]> SALOME platform Git repositories - modules/gui.git/commitdiff
Salome HOME
Fix crash if other view is the same as OCC, but it has no "synchronization" action
authormpv <mpv@opencascade.com>
Thu, 26 Apr 2012 10:03:09 +0000 (10:03 +0000)
committermpv <mpv@opencascade.com>
Thu, 26 Apr 2012 10:03:09 +0000 (10:03 +0000)
src/OCCViewer/OCCViewer_ViewWindow.cxx

index 1c32abc73ea9b4373084b4793ebd246a8ba064d5..26e9ba79db5f86e6772d1b1dbdce2634d67a52a6 100755 (executable)
@@ -2556,11 +2556,14 @@ void OCCViewer_ViewWindow::synchronizeView( OCCViewer_ViewWindow* viewWindow, in
       // synchronize target view with source view
       viewWindow->getViewPort()->synchronize( otherViewWindow->getViewPort() );
       viewWindow->toolMgr()->action( SynchronizeId )->setData( otherViewWindow->getId() );
-      otherViewWindow->toolMgr()->action( SynchronizeId )->setData( viewWindow->getId() );
-      if ( !otherViewWindow->toolMgr()->action( SynchronizeId )->isChecked() ) {
-       bool blocked = otherViewWindow->toolMgr()->action( SynchronizeId )->blockSignals( true );
-       otherViewWindow->toolMgr()->action( SynchronizeId )->setChecked( true );
-       otherViewWindow->toolMgr()->action( SynchronizeId )->blockSignals( blocked );
+      QAction* anOtherAcion = otherViewWindow->toolMgr()->action( SynchronizeId );
+      if (anOtherAcion) {
+        anOtherAcion->setData( viewWindow->getId() );
+        if ( !anOtherAcion->isChecked() ) {
+               bool blocked = anOtherAcion->blockSignals( true );
+               anOtherAcion->setChecked( true );
+               anOtherAcion->blockSignals( blocked );
+        }
       }
     }
   }
@@ -2570,10 +2573,13 @@ void OCCViewer_ViewWindow::synchronizeView( OCCViewer_ViewWindow* viewWindow, in
     viewWindow->getViewPort()->disconnect( SIGNAL( vpTransformed( OCCViewer_ViewPort* ) ), otherViewWindow->getViewPort(), SLOT( synchronize( OCCViewer_ViewPort* ) ) );
     viewWindow->getViewPort()->synchronize( otherViewWindow->getViewPort() );
     viewWindow->toolMgr()->action( SynchronizeId )->setData( otherViewWindow->getId() );
-    if ( otherViewWindow->toolMgr()->action( SynchronizeId )->data().toInt() == viewWindow->getId() && otherViewWindow->toolMgr()->action( SynchronizeId )->isChecked() ) {
-      bool blocked = otherViewWindow->toolMgr()->action( SynchronizeId )->blockSignals( true );
-      otherViewWindow->toolMgr()->action( SynchronizeId )->setChecked( false );
-      otherViewWindow->toolMgr()->action( SynchronizeId )->blockSignals( blocked );
+    QAction* anOtherAcion = otherViewWindow->toolMgr()->action( SynchronizeId );
+    if (anOtherAcion) {
+      if ( anOtherAcion->data().toInt() == viewWindow->getId() && anOtherAcion->isChecked() ) {
+        bool blocked = anOtherAcion->blockSignals( true );
+        anOtherAcion->setChecked( false );
+        anOtherAcion->blockSignals( blocked );
+      }
     }
   }
 }