Salome HOME
Fix for PAL6826.
[modules/geom.git] / src / GEOMFiltersSelection / GEOM_ShapeTypeFilter.cxx
index 9d98cc99875f48327a67120c17d1bc0931cfb861..1de7bd2e01f7a16cddb7574fa8f07cb366121e64 100644 (file)
@@ -17,7 +17,7 @@
 //  License along with this library; if not, write to the Free Software 
 //  Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA  02111-1307 USA 
 // 
-//  See http://www.opencascade.org/SALOME/ or email : webmaster.salome@opencascade.org 
+// See http://www.salome-platform.org/ or email : webmaster.salome@opencascade.com
 //
 //
 //
@@ -26,7 +26,8 @@
 //  Module : GEOM
 //  $Header$
 
-using namespace std;
+#include <Standard_Stream.hxx>
+
 #include "GEOM_ShapeTypeFilter.ixx"
 #include "SALOME_InteractiveObject.hxx"
 #include "GEOM_Client.hxx"
@@ -44,8 +45,11 @@ static bool getShape( const GEOM::GEOM_Object_ptr& theObject, TopoDS_Shape& theS
 {
   if ( !CORBA::is_nil( theObject ) )
   {
-    Engines::Component_var comp = QAD_Application::getDesktop()->getEngine( "FactoryServer", "GEOM" );
-    GEOM::GEOM_Gen_var myGeom   = GEOM::GEOM_Gen::_narrow( comp );
+    static GEOM::GEOM_Gen_var myGeom;
+    if(CORBA::is_nil(myGeom) {
+      Engines::Component_var comp = QAD_Application::getDesktop()->getEngine( "FactoryServer", "GEOM" );
+      myGeom = GEOM::GEOM_Gen::_narrow( comp );
+    }
     TopoDS_Shape aTopoDSShape = GEOM_Client().GetShape( myGeom, theObject );
         
     if ( !aTopoDSShape.IsNull() )