- singletons are deleted at exit (atexit function is called at the beginning of programs)
but order is important. Trace singleton must be destroyed last because MESSAGE
and others are called in destructor of other singletons.
So I have enforced local trace initialization in ATEXIT_ class from Utils directory
- Improve Registry shutdown (called _remove_ref to delete RegistryService object)
- add a delay between shutdown servers and kill omninames in shutdownSalome.py
#!/usr/bin/env python
+import time
import salome
salome.salome_init()
salome.lcc.shutdownServers()
-salome.SALOME_LifeCycleCORBA_killOmniNames()
+#give some time to shutdown to complete
+time.sleep(1)
+salome.LifeCycleCORBA.killOmniNames()
void SessionName( const char *sessionName ) ;
- void SetOrb( CORBA::ORB_ptr orb ) { _orb = orb; return; }
+ void SetOrb( CORBA::ORB_ptr orb ) { _orb = CORBA::ORB::_duplicate(orb); return; }
void Shutdown() { if(!CORBA::is_nil(_orb)) _orb->shutdown(0); }
ptrRegistry->SessionName( ptrSessionName ) ;
ptrRegistry->SetOrb(orb);
varComponents = ptrRegistry->_this() ;
+ ptrRegistry->_remove_ref(); //let poa manage registryservice deletion
// The RegistryService must not already exist.
try
# include "Utils_DESTRUCTEUR_GENERIQUE.hxx"
//# include "utilities.h"
+# include "LocalTraceBufferPool.hxx"
void Nettoyage();
#ifdef _DEBUG_
DESTRUCTEUR_GENERIQUE_::Destructeurs =
new std::list<DESTRUCTEUR_GENERIQUE_*> ; // Destructeur alloue dynamiquement (cf. ci-dessous) ,
// il est utilise puis detruit par la fonction Nettoyage
+ //To be sure the trace singleton will be the last one to be destroyed initialize it here before calling atexit
+ LocalTraceBufferPool::instance();
int cr = atexit( Nettoyage ); // execute Nettoyage lors de exit, aprs la destruction des donnees statiques !
assert(cr==0) ;
ATEXIT_Done = true ;
};
-# endif /* # if !defined( __SINGLETON__H__ ) */
+# endif /* # if !defined( __DESTRUCTEUR_GENERIQUE__H__ ) */