From fa6b4c6615dbe469d185a85a934d0cf3c8faf39b Mon Sep 17 00:00:00 2001 From: vsr Date: Wed, 2 Apr 2014 12:05:48 +0400 Subject: [PATCH] Fix pb with persistence of "light" modules: SaveAs operation leads to loss of non-loaded "light" modules data. --- src/CMakeLists.txt | 2 +- src/SalomeApp/CMakeLists.txt | 5 +++-- src/SalomeApp/SalomeApp_Engine_i.cxx | 6 +++--- src/SalomeApp/SalomeApp_Engine_i.h | 6 +++--- src/Session/CMakeLists.txt | 4 +++- src/Session/Session_Session_i.cxx | 14 ++++++++++---- 6 files changed, 23 insertions(+), 14 deletions(-) diff --git a/src/CMakeLists.txt b/src/CMakeLists.txt index fc55f70e9..08c7b287c 100755 --- a/src/CMakeLists.txt +++ b/src/CMakeLists.txt @@ -108,7 +108,7 @@ SET(SUBDIRS_LIGHT LightApp ResExporter) # Full (CORBA) SALOME packages ## IF(NOT SALOME_LIGHT_ONLY) - SET(SUBDIRS_CORBA TOOLSGUI Session SalomeApp GuiHelpers TreeData) + SET(SUBDIRS_CORBA TOOLSGUI SalomeApp Session GuiHelpers TreeData) ENDIF(NOT SALOME_LIGHT_ONLY) SET(SUBDIRS diff --git a/src/SalomeApp/CMakeLists.txt b/src/SalomeApp/CMakeLists.txt index 65f278da4..0cbb035e0 100755 --- a/src/SalomeApp/CMakeLists.txt +++ b/src/SalomeApp/CMakeLists.txt @@ -49,7 +49,6 @@ INCLUDE_DIRECTORIES( ${PROJECT_SOURCE_DIR}/src/STD ${PROJECT_SOURCE_DIR}/src/SUIT ${PROJECT_SOURCE_DIR}/src/SVTK - ${PROJECT_SOURCE_DIR}/src/Session ${PROJECT_SOURCE_DIR}/src/TOOLSGUI ${PROJECT_SOURCE_DIR}/src/VTKViewer ) @@ -116,7 +115,9 @@ IF(SALOME_USE_SALOMEOBJECT) ENDIF() IF(NOT SALOME_LIGHT_ONLY) - LIST(APPEND _link_LIBRARIES SalomeSession) + LIST(APPEND _link_LIBRARIES SalomeIDLGUI) + LIST(APPEND _link_LIBRARIES ${KERNEL_SalomeContainer}) + LIST(APPEND _link_LIBRARIES ${KERNEL_SalomeLifeCycleCORBA}) ENDIF() # --- headers --- diff --git a/src/SalomeApp/SalomeApp_Engine_i.cxx b/src/SalomeApp/SalomeApp_Engine_i.cxx index c8d71de18..3fcbd310f 100644 --- a/src/SalomeApp/SalomeApp_Engine_i.cxx +++ b/src/SalomeApp/SalomeApp_Engine_i.cxx @@ -340,7 +340,7 @@ SALOME_NamingService* SalomeApp_Engine_i::namingService() \param theComponentName - synthetic "component data type" used to identify a given light module \return Object reference to the CORBA engine */ -CORBA::Object_ptr SalomeApp_Engine_i::engineForComponent( const char* theComponentName, +CORBA::Object_ptr SalomeApp_Engine_i::EngineForComponent( const char* theComponentName, bool toCreate ) { CORBA::Object_var anEngine; @@ -384,7 +384,7 @@ std::string SalomeApp_Engine_i::EngineIORForComponent( const char* theComponentN bool toCreate ) { std::string anIOR( "" ); - CORBA::Object_var anEngine = engineForComponent( theComponentName, toCreate ); + CORBA::Object_var anEngine = EngineForComponent( theComponentName, toCreate ); if ( !CORBA::is_nil( anEngine ) ) { CORBA::String_var objStr = orb()->object_to_string( anEngine.in() ); @@ -402,7 +402,7 @@ SalomeApp_Engine_i* SalomeApp_Engine_i::GetInstance( const char* theComponentNam bool toCreate ) { SalomeApp_Engine_i* aServant = 0; - CORBA::Object_var anEngine = engineForComponent( theComponentName, toCreate ); + CORBA::Object_var anEngine = EngineForComponent( theComponentName, toCreate ); if ( !CORBA::is_nil( anEngine ) ) { PortableServer::Servant aServantBase = poa()->reference_to_servant( anEngine.in() ); diff --git a/src/SalomeApp/SalomeApp_Engine_i.h b/src/SalomeApp/SalomeApp_Engine_i.h index 71d63cb94..bb565758c 100644 --- a/src/SalomeApp/SalomeApp_Engine_i.h +++ b/src/SalomeApp/SalomeApp_Engine_i.h @@ -72,6 +72,9 @@ public: static SalomeApp_Engine_i* GetInstance ( const char* theComponentName, bool toCreate ); + static CORBA::Object_ptr EngineForComponent( const char* theComponentName, + bool toCreate ); + public: // methods from SALOMEDS::Driver without implementation. Must be redefined because // there is no default implementation of SALOMEDS::Driver interface @@ -94,9 +97,6 @@ private: static CORBA::ORB_var orb(); static PortableServer::POA_var poa(); static SALOME_NamingService* namingService(); - static CORBA::Object_ptr engineForComponent( const char* theComponentName, - bool toCreate ); - private: typedef std::map MapOfListOfFiles; MapOfListOfFiles myMap; diff --git a/src/Session/CMakeLists.txt b/src/Session/CMakeLists.txt index 29c25ae6f..08ea8d390 100755 --- a/src/Session/CMakeLists.txt +++ b/src/Session/CMakeLists.txt @@ -28,10 +28,12 @@ INCLUDE_DIRECTORIES( ${OMNIORB_INCLUDE_DIR} ${PTHREAD_INCLUDE_DIR} ${PROJECT_BINARY_DIR} + ${PROJECT_BINARY_DIR}/idl ${PROJECT_SOURCE_DIR}/src/Qtx ${PROJECT_SOURCE_DIR}/src/SUIT ${PROJECT_SOURCE_DIR}/src/Event ${PROJECT_SOURCE_DIR}/src/Style + ${PROJECT_SOURCE_DIR}/src/SalomeApp ) # additional preprocessor / compiler flags @@ -63,7 +65,7 @@ SET(_link_LIBRARIES ${KERNEL_SalomeLauncher} ${KERNEL_Registry} ${KERNEL_SALOMEBasics} - qtx suit Event SalomeStyle SalomeIDLGUI + qtx suit Event SalomeStyle SalomeApp SalomeIDLGUI ) IF(ENABLE_TESTRECORDER) LIST(APPEND _link_LIBRARIES ${TESTRECORDER_LIBS}) diff --git a/src/Session/Session_Session_i.cxx b/src/Session/Session_Session_i.cxx index 0e08eb3e5..c5bb83a04 100755 --- a/src/Session/Session_Session_i.cxx +++ b/src/Session/Session_Session_i.cxx @@ -29,7 +29,7 @@ #include "SALOME_NamingService.hxx" #include "SALOME_Event.h" - +#include "SalomeApp_Engine_i.h" #include "SUIT_Session.h" #include "SUIT_Desktop.h" #include "SUIT_Study.h" @@ -80,10 +80,16 @@ Engines::EngineComponent_ptr SALOME_Session_i::GetComponent(const char* theLibra typedef Engines::EngineComponent_ptr TGetImpl(CORBA::ORB_ptr, PortableServer::POA_ptr, SALOME_NamingService*,QMutex*); - OSD_SharedLibrary aSharedLibrary(const_cast(theLibraryName)); - if(aSharedLibrary.DlOpen(OSD_RTLD_LAZY)) - if(OSD_Function anOSDFun = aSharedLibrary.DlSymb("GetImpl")) + OSD_SharedLibrary aSharedLibrary(const_cast(theLibraryName)); + if (aSharedLibrary.DlOpen(OSD_RTLD_LAZY)) { + if (OSD_Function anOSDFun = aSharedLibrary.DlSymb("GetImpl")) return ((TGetImpl (*)) anOSDFun)(_orb,_poa,_NS,_GUIMutex); + } + CORBA::Object_var obj = SalomeApp_Engine_i::EngineForComponent(theLibraryName, true); + if (!CORBA::is_nil(obj)){ + Engines::EngineComponent_var anEngine = Engines::EngineComponent::_narrow(obj); + return anEngine._retn(); + } return Engines::EngineComponent::_nil(); } -- 2.39.2