mirror of
https://git.salome-platform.org/gitpub/modules/geom.git
synced 2025-04-24 01:12:05 +05:00
patchGeomMemoryLeaks.dat by Christian CAREMOLI.
This commit is contained in:
parent
696ce8ca9f
commit
67d3018cd8
@ -117,6 +117,25 @@ GEOM_Engine::GEOM_Engine()
|
|||||||
//_lastObjectTag = 0;
|
//_lastObjectTag = 0;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
/*!
|
||||||
|
* Destructor
|
||||||
|
*/
|
||||||
|
GEOM_Engine::~GEOM_Engine()
|
||||||
|
{
|
||||||
|
GEOM_DataMapIteratorOfDataMapOfAsciiStringTransient It(_objects);
|
||||||
|
for(; It.More(); It.Next())
|
||||||
|
{
|
||||||
|
RemoveObject(Handle(GEOM_Object)::DownCast(It.Value()));
|
||||||
|
}
|
||||||
|
|
||||||
|
//Close all documents not closed
|
||||||
|
for(Interface_DataMapIteratorOfDataMapOfIntegerTransient anItr(_mapIDDocument); anItr.More(); anItr.Next())
|
||||||
|
Close(anItr.Key());
|
||||||
|
|
||||||
|
_mapIDDocument.Clear();
|
||||||
|
_objects.Clear();
|
||||||
|
}
|
||||||
|
|
||||||
//=============================================================================
|
//=============================================================================
|
||||||
/*!
|
/*!
|
||||||
* GetDocument
|
* GetDocument
|
||||||
|
@ -36,7 +36,7 @@ class GEOM_Engine
|
|||||||
{
|
{
|
||||||
public:
|
public:
|
||||||
Standard_EXPORT GEOM_Engine();
|
Standard_EXPORT GEOM_Engine();
|
||||||
Standard_EXPORT ~GEOM_Engine() { _mapIDDocument.Clear(); _objects.Clear(); }
|
Standard_EXPORT virtual ~GEOM_Engine();
|
||||||
|
|
||||||
//Retuns the engine
|
//Retuns the engine
|
||||||
Standard_EXPORT static GEOM_Engine* GetEngine();
|
Standard_EXPORT static GEOM_Engine* GetEngine();
|
||||||
|
@ -565,8 +565,8 @@ SALOMEDS::SObject_ptr GEOM_Gen_i::AddInStudy(SALOMEDS::Study_ptr theStudy, GEOM:
|
|||||||
//============================================================================
|
//============================================================================
|
||||||
void GEOM_Gen_i::register_name(char * name)
|
void GEOM_Gen_i::register_name(char * name)
|
||||||
{
|
{
|
||||||
GEOM::GEOM_Gen_ptr g = GEOM::GEOM_Gen::_narrow(_this());
|
GEOM::GEOM_Gen_var g = _this();
|
||||||
name_service->Register(g, CORBA::string_dup(name));
|
name_service->Register(g, name);
|
||||||
}
|
}
|
||||||
|
|
||||||
//============================================================================
|
//============================================================================
|
||||||
@ -599,6 +599,7 @@ GEOM::GEOM_IBasicOperations_ptr GEOM_Gen_i::GetIBasicOperations(CORBA::Long theS
|
|||||||
|
|
||||||
GEOM::GEOM_Gen_ptr engine = _this();
|
GEOM::GEOM_Gen_ptr engine = _this();
|
||||||
|
|
||||||
|
//transfer reference on engine
|
||||||
GEOM_IBasicOperations_i* aServant =
|
GEOM_IBasicOperations_i* aServant =
|
||||||
new GEOM_IBasicOperations_i(_poa, engine, _impl->GetIBasicOperations(theStudyID));
|
new GEOM_IBasicOperations_i(_poa, engine, _impl->GetIBasicOperations(theStudyID));
|
||||||
|
|
||||||
@ -928,7 +929,8 @@ GEOM_I_EXPORT
|
|||||||
const char * interfaceName)
|
const char * interfaceName)
|
||||||
{
|
{
|
||||||
GEOM_Gen_i * myGEOM_Gen_i = new GEOM_Gen_i(orb, poa, contId, instanceName, interfaceName);
|
GEOM_Gen_i * myGEOM_Gen_i = new GEOM_Gen_i(orb, poa, contId, instanceName, interfaceName);
|
||||||
myGEOM_Gen_i->register_name("/myGEOM_Gen"); // NRI : 11/07/2002 : Add for Supervision example
|
// Don't understand the reason of this register ????
|
||||||
|
// myGEOM_Gen_i->register_name("/myGEOM_Gen"); // NRI : 11/07/2002 : Add for Supervision example
|
||||||
return myGEOM_Gen_i->getId();
|
return myGEOM_Gen_i->getId();
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@ -247,8 +247,9 @@ GEOM::GEOM_Object_ptr GEOM_I3DPrimOperations_i::MakeSpherePntR
|
|||||||
if (thePnt == NULL) return aGEOMObject._retn();
|
if (thePnt == NULL) return aGEOMObject._retn();
|
||||||
|
|
||||||
//Get the reference point
|
//Get the reference point
|
||||||
|
CORBA::String_var entry=thePnt->GetEntry();
|
||||||
Handle(GEOM_Object) aPnt = GetOperations()->GetEngine()->GetObject
|
Handle(GEOM_Object) aPnt = GetOperations()->GetEngine()->GetObject
|
||||||
(thePnt->GetStudyID(), thePnt->GetEntry());
|
(thePnt->GetStudyID(), entry);
|
||||||
|
|
||||||
if (aPnt.IsNull()) return aGEOMObject._retn();
|
if (aPnt.IsNull()) return aGEOMObject._retn();
|
||||||
|
|
||||||
|
@ -72,10 +72,12 @@ GEOM::GEOM_Object_ptr GEOM_IBooleanOperations_i::MakeBoolean
|
|||||||
if (theShape1 == NULL || theShape2 == NULL) return aGEOMObject._retn();
|
if (theShape1 == NULL || theShape2 == NULL) return aGEOMObject._retn();
|
||||||
|
|
||||||
//Get the reference shapes
|
//Get the reference shapes
|
||||||
|
CORBA::String_var entry=theShape1->GetEntry();
|
||||||
Handle(GEOM_Object) aSh1 = GetOperations()->GetEngine()->GetObject
|
Handle(GEOM_Object) aSh1 = GetOperations()->GetEngine()->GetObject
|
||||||
(theShape1->GetStudyID(), theShape1->GetEntry());
|
(theShape1->GetStudyID(), entry);
|
||||||
|
entry=theShape2->GetEntry();
|
||||||
Handle(GEOM_Object) aSh2 = GetOperations()->GetEngine()->GetObject
|
Handle(GEOM_Object) aSh2 = GetOperations()->GetEngine()->GetObject
|
||||||
(theShape2->GetStudyID(), theShape2->GetEntry());
|
(theShape2->GetStudyID(), entry);
|
||||||
|
|
||||||
if (aSh1.IsNull() || aSh2.IsNull()) return aGEOMObject._retn();
|
if (aSh1.IsNull() || aSh2.IsNull()) return aGEOMObject._retn();
|
||||||
|
|
||||||
|
@ -59,7 +59,7 @@ class GEOM_I_EXPORT GEOM_IOperations_i : public virtual POA_GEOM::GEOM_IOperatio
|
|||||||
private:
|
private:
|
||||||
|
|
||||||
::GEOM_IOperations* _impl;
|
::GEOM_IOperations* _impl;
|
||||||
GEOM::GEOM_Gen_ptr _engine;
|
GEOM::GEOM_Gen_var _engine;
|
||||||
};
|
};
|
||||||
|
|
||||||
#endif
|
#endif
|
||||||
|
@ -61,7 +61,9 @@ GEOM_Object_i::GEOM_Object_i (PortableServer::POA_ptr thePOA, GEOM::GEOM_Gen_ptr
|
|||||||
//=============================================================================
|
//=============================================================================
|
||||||
|
|
||||||
GEOM_Object_i::~GEOM_Object_i()
|
GEOM_Object_i::~GEOM_Object_i()
|
||||||
{}
|
{
|
||||||
|
GEOM_Engine::GetEngine()->RemoveObject(_impl);
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
//=============================================================================
|
//=============================================================================
|
||||||
|
@ -85,7 +85,7 @@ class GEOM_I_EXPORT GEOM_Object_i : public virtual POA_GEOM::GEOM_Object, public
|
|||||||
|
|
||||||
private:
|
private:
|
||||||
|
|
||||||
GEOM::GEOM_Gen_ptr _engine;
|
GEOM::GEOM_Gen_var _engine;
|
||||||
Handle(GEOM_Object) _impl;
|
Handle(GEOM_Object) _impl;
|
||||||
TopoDS_Shape _geom;
|
TopoDS_Shape _geom;
|
||||||
};
|
};
|
||||||
|
@ -70,6 +70,12 @@ GEOM_Superv_i::GEOM_Superv_i(CORBA::ORB_ptr orb,
|
|||||||
GEOM_Superv_i::~GEOM_Superv_i()
|
GEOM_Superv_i::~GEOM_Superv_i()
|
||||||
{
|
{
|
||||||
MESSAGE("GEOM_Superv_i::~GEOM_Superv_i");
|
MESSAGE("GEOM_Superv_i::~GEOM_Superv_i");
|
||||||
|
if (!CORBA::is_nil(myBasicOp))
|
||||||
|
myBasicOp->Destroy();
|
||||||
|
if (!CORBA::is_nil(myBoolOp))
|
||||||
|
myBoolOp->Destroy();
|
||||||
|
if (!CORBA::is_nil(my3DPrimOp))
|
||||||
|
my3DPrimOp->Destroy();
|
||||||
delete name_service;
|
delete name_service;
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -79,8 +85,8 @@ GEOM_Superv_i::~GEOM_Superv_i()
|
|||||||
//============================================================================
|
//============================================================================
|
||||||
void GEOM_Superv_i::register_name(char * name)
|
void GEOM_Superv_i::register_name(char * name)
|
||||||
{
|
{
|
||||||
GEOM::GEOM_Superv_ptr g = GEOM::GEOM_Superv::_narrow(POA_GEOM::GEOM_Superv::_this());
|
GEOM::GEOM_Superv_var g = _this();
|
||||||
name_service->Register(g, strdup(name));
|
name_service->Register(g, name);
|
||||||
}
|
}
|
||||||
|
|
||||||
//=============================================================================
|
//=============================================================================
|
||||||
@ -88,9 +94,17 @@ void GEOM_Superv_i::register_name(char * name)
|
|||||||
//=============================================================================
|
//=============================================================================
|
||||||
void GEOM_Superv_i::setGeomEngine()
|
void GEOM_Superv_i::setGeomEngine()
|
||||||
{
|
{
|
||||||
|
if ( !CORBA::is_nil(myGeomEngine) )
|
||||||
|
return;
|
||||||
// get GEOM_Gen engine
|
// get GEOM_Gen engine
|
||||||
|
/*
|
||||||
SALOME_LifeCycleCORBA* lcc = new SALOME_LifeCycleCORBA( name_service );
|
SALOME_LifeCycleCORBA* lcc = new SALOME_LifeCycleCORBA( name_service );
|
||||||
Engines::Component_var comp = lcc->FindOrLoad_Component( "FactoryServer", "GEOM" );
|
Engines::Component_var comp = lcc->FindOrLoad_Component( "FactoryServer", "GEOM" );
|
||||||
|
*/
|
||||||
|
|
||||||
|
Engines::Container_var cont=GetContainerRef();
|
||||||
|
cont->load_component_Library("GEOM");
|
||||||
|
Engines::Component_var comp=cont->create_component_instance("GEOM",0);
|
||||||
|
|
||||||
myGeomEngine = GEOM::GEOM_Gen::_narrow(comp);
|
myGeomEngine = GEOM::GEOM_Gen::_narrow(comp);
|
||||||
}
|
}
|
||||||
@ -799,7 +813,9 @@ GEOM::GEOM_Object_ptr GEOM_Superv_i::MakeSphere (CORBA::Double theX,
|
|||||||
MESSAGE("GEOM_Superv_i::MakeSphepe");
|
MESSAGE("GEOM_Superv_i::MakeSphepe");
|
||||||
getBasicOp();
|
getBasicOp();
|
||||||
get3DPrimOp();
|
get3DPrimOp();
|
||||||
GEOM::GEOM_Object_ptr anObj = my3DPrimOp->MakeSpherePntR(myBasicOp->MakePointXYZ(theX, theY, theZ), theRadius);
|
GEOM::GEOM_Object_var o = myBasicOp->MakePointXYZ(theX, theY, theZ);
|
||||||
|
GEOM::GEOM_Object_ptr anObj = my3DPrimOp->MakeSpherePntR(o, theRadius);
|
||||||
|
o->Destroy();
|
||||||
endService( " GEOM_Superv_i::MakeSphepe" );
|
endService( " GEOM_Superv_i::MakeSphepe" );
|
||||||
return anObj;
|
return anObj;
|
||||||
}
|
}
|
||||||
@ -2737,7 +2753,8 @@ extern "C"
|
|||||||
const char * interfaceName)
|
const char * interfaceName)
|
||||||
{
|
{
|
||||||
GEOM_Superv_i * myGEOM_Superv_i = new GEOM_Superv_i(orb, poa, contId, instanceName, interfaceName);
|
GEOM_Superv_i * myGEOM_Superv_i = new GEOM_Superv_i(orb, poa, contId, instanceName, interfaceName);
|
||||||
myGEOM_Superv_i->register_name("/myGEOM_Superv");
|
//Don't understand the reason why this component is registered ???
|
||||||
|
// myGEOM_Superv_i->register_name("/myGEOM_Superv");
|
||||||
return myGEOM_Superv_i->getId() ;
|
return myGEOM_Superv_i->getId() ;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@ -566,21 +566,21 @@ public:
|
|||||||
|
|
||||||
private:
|
private:
|
||||||
SALOME_NamingService * name_service;
|
SALOME_NamingService * name_service;
|
||||||
GEOM::GEOM_Gen_ptr myGeomEngine;
|
GEOM::GEOM_Gen_var myGeomEngine;
|
||||||
CORBA::Long myStudyID;
|
CORBA::Long myStudyID;
|
||||||
CORBA::Long myLastStudyID; // mkr : PAL10770
|
CORBA::Long myLastStudyID; // mkr : PAL10770
|
||||||
PortableServer::POA_var myPOA;
|
PortableServer::POA_var myPOA;
|
||||||
|
|
||||||
GEOM::GEOM_IBasicOperations_ptr myBasicOp;
|
GEOM::GEOM_IBasicOperations_var myBasicOp;
|
||||||
GEOM::GEOM_I3DPrimOperations_ptr my3DPrimOp;
|
GEOM::GEOM_I3DPrimOperations_var my3DPrimOp;
|
||||||
GEOM::GEOM_IBooleanOperations_ptr myBoolOp;
|
GEOM::GEOM_IBooleanOperations_var myBoolOp;
|
||||||
GEOM::GEOM_IInsertOperations_ptr myInsOp;
|
GEOM::GEOM_IInsertOperations_var myInsOp;
|
||||||
GEOM::GEOM_ITransformOperations_ptr myTransfOp;
|
GEOM::GEOM_ITransformOperations_var myTransfOp;
|
||||||
GEOM::GEOM_IShapesOperations_ptr myShapesOp;
|
GEOM::GEOM_IShapesOperations_var myShapesOp;
|
||||||
GEOM::GEOM_IBlocksOperations_ptr myBlocksOp;
|
GEOM::GEOM_IBlocksOperations_var myBlocksOp;
|
||||||
GEOM::GEOM_ICurvesOperations_ptr myCurvesOp;
|
GEOM::GEOM_ICurvesOperations_var myCurvesOp;
|
||||||
GEOM::GEOM_ILocalOperations_ptr myLocalOp;
|
GEOM::GEOM_ILocalOperations_var myLocalOp;
|
||||||
GEOM::GEOM_IGroupOperations_ptr myGroupOp;
|
GEOM::GEOM_IGroupOperations_var myGroupOp;
|
||||||
|
|
||||||
};
|
};
|
||||||
|
|
||||||
|
Loading…
x
Reference in New Issue
Block a user