Salome HOME
refs #610: correct processing of open new document, when create calculation case...
authormkr <mkr@opencascade.com>
Fri, 20 Nov 2015 08:53:53 +0000 (11:53 +0300)
committermkr <mkr@opencascade.com>
Fri, 20 Nov 2015 08:53:53 +0000 (11:53 +0300)
src/HYDROGUI/HYDROGUI_LandCoverMapOp.cxx
src/HYDROGUI/HYDROGUI_Module.cxx

index 3f54816fdc09b1c7a81bf4016691cd9454b9d499..6426928ffcc0abd1874e10baef2245f8a37ce0a3 100644 (file)
@@ -40,6 +40,7 @@
 
 #include <OCCViewer_ViewManager.h>
 
+#include <SalomeApp_Study.h>
 #include <LightApp_Application.h>
 #include <LightApp_SelectionMgr.h>
 #include <LightApp_DataOwner.h>
@@ -156,7 +157,9 @@ void HYDROGUI_LandCoverMapOp::abortOperation()
 
   HYDROGUI_Operation::abortOperation();
 
-  module()->update( UF_OCCViewer | UF_FitAll );
+  SalomeApp_Study* aStudy = dynamic_cast<SalomeApp_Study*>( module()->getApp()->activeStudy() );
+  if ( aStudy )
+    module()->update( UF_OCCViewer | UF_FitAll );
 }
 
 void HYDROGUI_LandCoverMapOp::commitOperation()
index 9b1d8f3d5334eead598b93f2ca9c9249ea2b0296..cd5a630bade3cce8eeb1f689d8131f6715a04dae 100644 (file)
@@ -1089,10 +1089,13 @@ void HYDROGUI_Module::setObjectVisible( const int theViewId,
     if ( hydroObject )
     {
         SUIT_AbstractModel* treeModel = dynamic_cast<SUIT_AbstractModel*>( getApp()->objectBrowser()->model() );
-        QString id = hydroObject->text( hydroObject->customData( Qtx::IdType ).toInt() );
-        Qtx::VisibilityState visState = treeModel->visibilityState( id );
-        if ( visState != Qtx::UnpresentableState )
+        if ( treeModel )
+        {
+          QString id = hydroObject->text( hydroObject->customData( Qtx::IdType ).toInt() );
+          Qtx::VisibilityState visState = treeModel->visibilityState( id );
+          if ( visState != Qtx::UnpresentableState )
             treeModel->setVisibilityState( id, theState ? Qtx::ShownState : Qtx::HiddenState );
+        }
     }
 
     if ( theObject->GetKind() == KIND_BATHYMETRY && theState ) {