From 5f7b6dc4b353c1cec5eb0b9a21961cd7b9dea2e9 Mon Sep 17 00:00:00 2001 From: jfa Date: Thu, 15 Sep 2005 13:38:08 +0000 Subject: [PATCH] Change representation: check type of object (VISU or not) before getting servant of it. --- src/VISUGUI/VisuGUI_Tools.cxx | 14 +++++++++----- 1 file changed, 9 insertions(+), 5 deletions(-) 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; -- 2.39.2