From: jfa Date: Thu, 15 Sep 2005 13:38:08 +0000 (+0000) Subject: Change representation: check type of object (VISU or not) before getting servant... X-Git-Tag: V3_1_0a1~4 X-Git-Url: http://git.salome-platform.org/gitweb/?a=commitdiff_plain;h=5f7b6dc4b353c1cec5eb0b9a21961cd7b9dea2e9;p=modules%2Fvisu.git Change representation: check type of object (VISU or not) before getting servant of it. --- diff --git a/src/VISUGUI/VisuGUI_Tools.cxx b/src/VISUGUI/VisuGUI_Tools.cxx index 24659007..cf7103a1 100644 --- a/src/VISUGUI/VisuGUI_Tools.cxx +++ b/src/VISUGUI/VisuGUI_Tools.cxx @@ -213,15 +213,15 @@ namespace VISU { if (CheckLock(GetCStudy(GetAppStudy(theModule)))) return NULL; - + CORBA::Object_var anObject = GetSelectedObj(theModule, theIO); - if (CORBA::is_nil(anObject)) + if (CORBA::is_nil(anObject)) return NULL; PortableServer::ServantBase_var aServant = VISU::GetServant(anObject); - if (!aServant.in()) + if (!aServant.in()) return NULL; - + return dynamic_cast(aServant.in()); } @@ -412,7 +412,7 @@ namespace VISU } } else { // Remove aSObject together with all its sub-objects - + VISU::RemoveFromStudy(theSObject, false, // remove not only IOR attribute, but Object With Children false); // not Destroy() sub-objects @@ -469,6 +469,10 @@ namespace VISU Handle(SALOME_InteractiveObject) anIO; CORBA::Object_var anObject = GetSelectedObj(theModule, &anIO); if (CORBA::is_nil(anObject)) return; + + VISU::Base_var aVisuObj = VISU::Base::_narrow(anObject); + if (CORBA::is_nil(aVisuObj)) return; + PortableServer::ServantBase_var aServant = VISU::GetServant(anObject); if (!aServant.in()) return;