From 7aa460553121edfc7f8e1bca3f0f2150679a2e6e Mon Sep 17 00:00:00 2001 From: eap Date: Fri, 14 Dec 2012 10:35:05 +0000 Subject: [PATCH] 21948: EDF SMESH : Memory is not freed when deleting a mesh Remove dependency on CORBA --- src/SALOMEDSImpl/CMakeLists.txt | 10 +-- src/SALOMEDSImpl/Makefile.am | 13 ++-- .../SALOMEDSImpl_AttributeIOR.cxx | 70 ++----------------- 3 files changed, 12 insertions(+), 81 deletions(-) diff --git a/src/SALOMEDSImpl/CMakeLists.txt b/src/SALOMEDSImpl/CMakeLists.txt index d3daf020f..1ee316e87 100755 --- a/src/SALOMEDSImpl/CMakeLists.txt +++ b/src/SALOMEDSImpl/CMakeLists.txt @@ -27,21 +27,17 @@ INCLUDE_DIRECTORIES( ${CMAKE_CURRENT_SOURCE_DIR}/../SALOMELocalTrace ${CMAKE_CURRENT_SOURCE_DIR}/../HDFPersist ${CMAKE_CURRENT_SOURCE_DIR}/../DF - ${CMAKE_CURRENT_SOURCE_DIR}/../GenericObj - ${CMAKE_BINARY_DIR}/idl ${CMAKE_BINARY_DIR} ) # This local variable defines the list of FLAGS common to all target in this package. -SET(COMMON_FLAGS "${HDF5_DEFINITIONS} ${OMNIORB_DEFINITIONS} ${BOOST_DEFINITIONS} ${PLATFORM_DEFINITIONS}") +SET(COMMON_FLAGS "${HDF5_DEFINITIONS} ${BOOST_DEFINITIONS} ${PLATFORM_DEFINITIONS}") # This local variable defines the list of dependant libraries common to all target in this package. SET(COMMON_LIBS SALOMEBasics SalomeHDFPersist DF - SalomeGenericObj - SalomeIDLKernel ${HDF5_LIBS} ) @@ -150,12 +146,12 @@ SET(SalomeDSImpl_SOURCES ADD_LIBRARY(SalomeDSImpl SHARED ${SalomeDSImpl_SOURCES}) SET_TARGET_PROPERTIES(SalomeDSImpl PROPERTIES COMPILE_FLAGS "${COMMON_FLAGS}") -TARGET_LINK_LIBRARIES(SalomeDSImpl SALOMELocalTrace ${COMMON_LIBS} ${OMNIORB_LIBS} ${PLATFORM_LIBS}) +TARGET_LINK_LIBRARIES(SalomeDSImpl SALOMELocalTrace ${COMMON_LIBS} ${PLATFORM_LIBS}) INSTALL(TARGETS SalomeDSImpl DESTINATION ${KERNEL_salomelib_LIBS}) ADD_EXECUTABLE(testDS testDS.cxx) SET_TARGET_PROPERTIES(testDS PROPERTIES COMPILE_FLAGS "${COMMON_FLAGS}") -TARGET_LINK_LIBRARIES(testDS SalomeDSImpl ${COMMON_LIBS} ${OMNIORB_LIBS} ${PLATFORM_LIBS}) +TARGET_LINK_LIBRARIES(testDS SalomeDSImpl ${COMMON_LIBS} ${PLATFORM_LIBS}) INSTALL(TARGETS testDS DESTINATION ${KERNEL_salomebin_BINS}) FILE(GLOB COMMON_HEADERS_HXX "${CMAKE_CURRENT_SOURCE_DIR}/*.hxx") diff --git a/src/SALOMEDSImpl/Makefile.am b/src/SALOMEDSImpl/Makefile.am index dac9a72ce..04d20e485 100644 --- a/src/SALOMEDSImpl/Makefile.am +++ b/src/SALOMEDSImpl/Makefile.am @@ -97,19 +97,15 @@ COMMON_CPPFLAGS=\ -I$(srcdir)/../SALOMELocalTrace \ -I$(srcdir)/../HDFPersist \ -I$(srcdir)/../DF \ - -I$(srcdir)/../GenericObj \ - -I$(top_builddir)/idl \ -I$(top_builddir) \ @HDF5_INCLUDES@ \ - @BOOST_CPPFLAGS@ @CORBA_CXXFLAGS@ @CORBA_INCLUDES@ + @BOOST_CPPFLAGS@ # This local variable defines the list of dependant libraries common to all target in this package. COMMON_LIBS =\ ../Basics/libSALOMEBasics.la \ ../HDFPersist/libSalomeHDFPersist.la \ ../DF/libDF.la \ - ../GenericObj/libSalomeGenericObj.la \ - $(top_builddir)/idl/libSalomeIDLKernel.la \ @HDF5_LIBS@ @@ -224,15 +220,14 @@ libSalomeDSImpl_la_SOURCES =\ libSalomeDSImpl_la_CPPFLAGS = $(COMMON_CPPFLAGS) libSalomeDSImpl_la_LDFLAGS = -no-undefined -version-info=0:0:0 -libSalomeDSImpl_la_LIBADD = $(COMMON_LIBS) $(CORBA_LIBS) +libSalomeDSImpl_la_LIBADD = $(COMMON_LIBS) # # =============================================================== # Executables targets # =============================================================== # -bin_PROGRAMS = testDS +bin_PROGRAMS = testDS testDS_SOURCES = testDS.cxx testDS_CPPFLAGS = $(COMMON_CPPFLAGS) -testDS_LDADD = libSalomeDSImpl.la ../DF/libDF.la \ - $(COMMON_LIBS) $(CORBA_LIBS) +testDS_LDADD = libSalomeDSImpl.la ../DF/libDF.la $(COMMON_LIBS) diff --git a/src/SALOMEDSImpl/SALOMEDSImpl_AttributeIOR.cxx b/src/SALOMEDSImpl/SALOMEDSImpl_AttributeIOR.cxx index a16108523..0a326aaf9 100644 --- a/src/SALOMEDSImpl/SALOMEDSImpl_AttributeIOR.cxx +++ b/src/SALOMEDSImpl/SALOMEDSImpl_AttributeIOR.cxx @@ -27,63 +27,6 @@ #include "SALOMEDSImpl_AttributeIOR.hxx" #include "SALOMEDSImpl_Study.hxx" -//to disable automatic genericobj management comment the following line -#define WITHGENERICOBJ - -#ifdef WITHGENERICOBJ -#include "SALOME_GenericObj_i.hh" - -static CORBA::ORB_var getORB() -{ - int argc=0; - return CORBA::ORB_init(argc,0); -} - -void IORGenericObjDecref(const std::string& anIOR) -{ - if(anIOR=="")return; - CORBA::Object_var obj; - SALOME::GenericObj_var gobj; - try - { - obj = getORB()->string_to_object(anIOR.c_str()); - if(obj->_non_existent())return; - gobj = SALOME::GenericObj::_narrow(obj); - if(! CORBA::is_nil(gobj) ) - { - gobj->UnRegister(); - } - } - catch(const CORBA::Exception& e) - { - } -} - -void IORGenericObjIncref(const std::string& anIOR) -{ - CORBA::Object_var obj; - SALOME::GenericObj_var gobj; - try - { - obj = getORB()->string_to_object(anIOR.c_str()); - if(obj->_non_existent())return; - gobj = SALOME::GenericObj::_narrow(obj); - if(! CORBA::is_nil(gobj) ) - { - gobj->Register(); - } - } - catch(const CORBA::Exception& e) - { - } -} -#else -void IORGenericObjDecref(const std::string& anIOR) -{} -void IORGenericObjIncref(const std::string& anIOR) -{} -#endif - //======================================================================= //function : GetID //purpose : @@ -95,14 +38,12 @@ const std::string& SALOMEDSImpl_AttributeIOR::GetID () return SALOMEDSImpl_AttributeIORID; } - - //======================================================================= //function : Set //purpose : //======================================================================= -SALOMEDSImpl_AttributeIOR* SALOMEDSImpl_AttributeIOR::Set (const DF_Label& L, +SALOMEDSImpl_AttributeIOR* SALOMEDSImpl_AttributeIOR::Set (const DF_Label& L, const std::string& S) { SALOMEDSImpl_AttributeIOR* A = NULL; @@ -123,14 +64,13 @@ void SALOMEDSImpl_AttributeIOR::SetValue(const std::string& theValue) { CheckLocked(); - SALOMEDSImpl_Study* study=SALOMEDSImpl_Study::GetStudy(Label()); - Backup(); //remove IOR entry in study if(theValue != myString) { - IORGenericObjIncref(theValue); - IORGenericObjDecref(myString); + SALOMEDSImpl_Study* study=SALOMEDSImpl_Study::GetStudy(Label()); + study->RegisterGenObj(theValue, Label()); + study->UnRegisterGenObj(myString, Label()); study->DeleteIORLabelMapItem(myString); } @@ -164,7 +104,7 @@ SALOMEDSImpl_AttributeIOR::SALOMEDSImpl_AttributeIOR() SALOMEDSImpl_AttributeIOR::~SALOMEDSImpl_AttributeIOR() { - IORGenericObjDecref(myString); + SALOMEDSImpl_Study::UnRegisterGenObj(myString, Label()); } //======================================================================= -- 2.39.2