------------------------------------------------------------------------
r1468 | eudoxos | 2008-08-14 19:17:50 +0200 (czw, 14 sie 2008) | 3 lines
Changed paths:
   M /trunk/core/Omega.cpp
   M /trunk/core/yade.cpp

1. Remove draw mutex when loading simulation introduced a few days ago (may 
throw boost::lock_error under some conditions)
2. Restore default signal handlers before exit from main; set SEGV handler to 
nullHandler since on i386 we (on lenny consistently) get crashes in some 
log4cxx destructor.

------------------------------------------------------------------------
Index: core/yade.cpp
===================================================================
--- core/yade.cpp       (revision 1467)
+++ core/yade.cpp       (revision 1468)
@@ -37,7 +37,7 @@
 #endif
 
 void nullHandler(int sig){
-       cerr<<"nullHandler called"<<endl;
+       cerr<<"WARN: nullHandler, signal 
"<<(sig==SIGSEGV?"SEGV":"[other]")<<endl;
 }
 
 void
@@ -252,6 +252,8 @@
                // Py_Finalize(); // FIXME: 
http://www.boost.org/libs/python/todo.html#pyfinalize-safety says this is 
unsafe with boost::python
        #endif
        #ifdef YADE_DEBUG
+               signal(SIGABRT,SIG_DFL); signal(SIGHUP,SIG_DFL); // default 
handlers
+               signal(SIGSEGV,nullHandler); // FIXME: this is to cover up 
crash that occurs in log4cxx on i386 sometimes 
                unlink(Omega::instance().gdbCrashBatch.c_str());
        #endif
 
Index: core/Omega.cpp
===================================================================
--- core/Omega.cpp      (revision 1467)
+++ core/Omega.cpp      (revision 1468)
@@ -231,18 +231,20 @@
        LOG_INFO("Loading file " + simulationFileName);
 
        // FIXME: stop rendering during loading - may lead to crash
-       boost::mutex::scoped_lock 
lock1(rootBody->transientInteractions->drawloopmutex);
-       boost::mutex::scoped_lock 
lock2(rootBody->persistentInteractions->drawloopmutex);
+       {
+               //boost::mutex::scoped_lock 
lock1(rootBody->persistentInteractions->drawloopmutex);
+               //boost::mutex::scoped_lock 
lock2(rootBody->transientInteractions->drawloopmutex);
                
-       if(algorithm::ends_with(simulationFileName,".xml") || 
algorithm::ends_with(simulationFileName,".xml.gz") || 
algorithm::ends_with(simulationFileName,".xml.bz2")){
-               resetRootBody();
-               
IOFormatManager::loadFromFile("XMLFormatManager",simulationFileName,"rootBody",rootBody);
+               if(algorithm::ends_with(simulationFileName,".xml") || 
algorithm::ends_with(simulationFileName,".xml.gz") || 
algorithm::ends_with(simulationFileName,".xml.bz2")){
+                       resetRootBody();
+                       
IOFormatManager::loadFromFile("XMLFormatManager",simulationFileName,"rootBody",rootBody);
+               }
+               else if(algorithm::ends_with(simulationFileName,".yade")){
+                       resetRootBody();
+                       
IOFormatManager::loadFromFile("BINFormatManager",simulationFileName,"rootBody",rootBody);
+               }
+               else throw (yadeBadFile("Extension of file not recognized."));
        }
-       else if(algorithm::ends_with(simulationFileName,".yade")){
-               resetRootBody();
-               
IOFormatManager::loadFromFile("BINFormatManager",simulationFileName,"rootBody",rootBody);
-       }
-       else throw (yadeBadFile("Extension of file not recognized."));
 
        if( rootBody->getClassName() != "MetaBody") throw yadeBadFile("Wrong 
file format (rootBody is not a MetaBody!) ??");
 

_______________________________________________
Mailing list: https://launchpad.net/~yade-dev
Post to     : [email protected]
Unsubscribe : https://launchpad.net/~yade-dev
More help   : https://help.launchpad.net/ListHelp

Reply via email to