From: nds Date: Wed, 7 Dec 2016 06:23:08 +0000 (+0300) Subject: Issue #1798 Error when loading a dumped script X-Git-Tag: before_porting_8.2.0~35 X-Git-Url: http://git.salome-platform.org/gitweb/?a=commitdiff_plain;h=e54f713ad9cdd5d164f7415a8a9adf3ce337056d;p=modules%2Fshaper.git Issue #1798 Error when loading a dumped script --- diff --git a/src/SHAPERGUI/SHAPERGUI_SalomeViewer.cpp b/src/SHAPERGUI/SHAPERGUI_SalomeViewer.cpp index f2bd66cae..15027a581 100644 --- a/src/SHAPERGUI/SHAPERGUI_SalomeViewer.cpp +++ b/src/SHAPERGUI/SHAPERGUI_SalomeViewer.cpp @@ -468,12 +468,16 @@ void SHAPERGUI_SalomeViewer::Zfitall() if (!mySelector || !mySelector->viewer()) return; SUIT_ViewManager* aMgr = mySelector->viewer()->getViewManager(); - OCCViewer_ViewFrame* aView = dynamic_cast(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(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