]> SALOME platform Git repositories - modules/shaper.git/commitdiff
Salome HOME
Issue #1798 Error when loading a dumped script
authornds <nds@opencascade.com>
Wed, 7 Dec 2016 06:23:08 +0000 (09:23 +0300)
committernds <nds@opencascade.com>
Wed, 7 Dec 2016 06:24:01 +0000 (09:24 +0300)
src/SHAPERGUI/SHAPERGUI_SalomeViewer.cpp

index f2bd66cae87a648d5b7a691d2c2fa192584dc252..15027a581e0b43255b1743195626e9d9b4c1ed2f 100644 (file)
@@ -468,12 +468,16 @@ void SHAPERGUI_SalomeViewer::Zfitall()
   if (!mySelector || !mySelector->viewer())
     return;
   SUIT_ViewManager* aMgr = mySelector->viewer()->getViewManager();
-  OCCViewer_ViewFrame* aView = dynamic_cast<OCCViewer_ViewFrame*>(aMgr->getActiveView());
-  if (aView) {
-    OCCViewer_ViewWindow* aWnd = aView->getView(OCCViewer_ViewFrame::MAIN_VIEW);
-    Handle(V3d_View) aView3d = aWnd->getViewPort()->getView();
-    aView3d->ZFitAll();
-    if (aView3d->Depth() < 0.1)
-      aView3d->DepthFitAll();
+  /// WORKAROUND for issue #1798. SUIT_ViewManager::closeAllViews() should nullify myActiveView
+  /// As a result, we need to check views count in manager
+  if (aMgr->getViews().size() > 0) {
+    OCCViewer_ViewFrame* aView = dynamic_cast<OCCViewer_ViewFrame*>(aMgr->getActiveView());
+    if (aView) {
+      OCCViewer_ViewWindow* aWnd = aView->getView(OCCViewer_ViewFrame::MAIN_VIEW);
+      Handle(V3d_View) aView3d = aWnd->getViewPort()->getView();
+      aView3d->ZFitAll();
+      if (aView3d->Depth() < 0.1)
+        aView3d->DepthFitAll();
+    }
   }
 }
\ No newline at end of file