From: apo Date: Fri, 3 Mar 2006 12:22:40 +0000 (+0000) Subject: Fix for Bug PAL11170 X-Git-Url: http://git.salome-platform.org/gitweb/?a=commitdiff_plain;h=c247d1015d2bc8dda21e4530474ad456dbad59f8;p=modules%2Fkernel.git Fix for Bug PAL11170 SIGSEGV when "extrusion along a path" gives no result --- diff --git a/src/CASCatch/CASCatch_CatchSignals.cxx b/src/CASCatch/CASCatch_CatchSignals.cxx index 9d4d5621a..ef64144c6 100644 --- a/src/CASCatch/CASCatch_CatchSignals.cxx +++ b/src/CASCatch/CASCatch_CatchSignals.cxx @@ -19,8 +19,6 @@ // #include "CASCatch_CatchSignals.hxx" -#include "CASCatch_Failure.hxx" -#include "CASCatch_ErrorHandler.hxx" #include #define MAX_HANDLER_NUMBER 6 @@ -31,13 +29,15 @@ * \brief creates a CASCatch_CatchSignals */ //================================================================================ -CASCatch_CatchSignals::CASCatch_CatchSignals() - :myIsActivated(Standard_False) +CASCatch_CatchSignals::CASCatch_CatchSignals(Standard_Boolean theIsActivate): + myIsActivated(Standard_False) { - Standard_Integer i = 0; for(; i<=MAX_HANDLER_NUMBER; i++) mySigStates[i] = NULL; + + if(theIsActivate) + Activate(); } #ifndef WNT @@ -112,7 +112,7 @@ static void Handler(const OSD_Signals theSig, const OSD_Signals) TCollection_AsciiString aMessage(theSig); aMessage+=" signal detected"; - CASCatch_Failure::Raise(aMessage.ToCString()); + Standard_Failure::Raise(aMessage.ToCString()); } @@ -129,7 +129,7 @@ static void SegvHandler(const OSD_Signals, const Standard_Address, const Standar sigaddset(&set, SIGSEGV); sigprocmask (SIG_UNBLOCK, &set, NULL); - CASCatch_Failure::Raise("SIGSEGV detected"); + Standard_Failure::Raise("SIGSEGV detected"); } #endif @@ -234,7 +234,7 @@ static Standard_Integer WntHandler(const Standard_Address theExceptionInfo) TCollection_AsciiString aMessage((Standard_Integer)dwExceptionCode); aMessage+=" Exception code - unexpected exception"; - CASCatch_Failure::Raise(aMessage.ToCString()); + Standard_Failure::Raise(aMessage.ToCString()); return EXCEPTION_EXECUTE_HANDLER; } @@ -260,15 +260,15 @@ static void SIGWntHandler(const int signum , const int theCode) OLDSIGWNTHANDLER = signal( signum , SIGWNTHANDLER ); if(theCode == _FPE_UNDERFLOW || theCode == _FPE_INEXACT) return; - CASCatch_Failure::Raise ("Floating point error"); + Standard_Failure::Raise ("Floating point error"); break; case SIGSEGV : OLDSIGWNTHANDLER = signal( signum , SIGWNTHANDLER ); - CASCatch_Failure::Raise("Access violation"); + Standard_Failure::Raise("Access violation"); break; case SIGILL : OLDSIGWNTHANDLER = signal( signum , SIGWNTHANDLER ); - CASCatch_Failure::Raise("Illegal instruction" ); + Standard_Failure::Raise("Illegal instruction" ); break; } } diff --git a/src/CASCatch/CASCatch_CatchSignals.hxx b/src/CASCatch/CASCatch_CatchSignals.hxx index e2293f3e1..1e56f54b5 100644 --- a/src/CASCatch/CASCatch_CatchSignals.hxx +++ b/src/CASCatch/CASCatch_CatchSignals.hxx @@ -22,6 +22,8 @@ #define _CASCatch_CatchSignals_HeaderFile #include +#include +#include /*! * \class CASCatch_CatchSignals @@ -34,7 +36,7 @@ public: // Methods PUBLIC // -Standard_EXPORT CASCatch_CatchSignals(); +Standard_EXPORT CASCatch_CatchSignals(Standard_Boolean theIsActivate = Standard_True); Standard_EXPORT void Destroy() ; ~CASCatch_CatchSignals() { Destroy(); } Standard_EXPORT void Activate() ; @@ -60,4 +62,31 @@ Standard_Boolean myIsActivated; }; +#ifdef try +# undef try +#endif + +#ifdef catch +# undef catch +#endif + +#ifdef NO_CXX_EXCEPTION +# if defined(DO_ABORT) +# define CASCatch_TRY \ + Standard_ErrorHandler _Function; \ + K_SETJMP = 1 ; \ + if(DoesNotAbort(_Function)) +# else //If DO_ABORT is not defined +# define CASCatch_TRY \ + Standard_ErrorHandler _Function; \ + if(DoesNotAbort(_Function)) +# endif //DO_ABORT +# define CASCatch_CATCH(Error) \ + else if(_Function.Catches(STANDARD_TYPE(Error))) +#else +# define CASCatch_TRY try +# define CASCatch_CATCH catch +#endif //NO_CXX_EXCEPTION + + #endif diff --git a/src/CASCatch/Makefile.in b/src/CASCatch/Makefile.in index f3477a8a5..9e77d0caf 100644 --- a/src/CASCatch/Makefile.in +++ b/src/CASCatch/Makefile.in @@ -11,21 +11,19 @@ VPATH=.:@srcdir@:@top_srcdir@/idl:$(top_srcdir)/idl @COMMENCE@ # header files -EXPORT_HEADERS= CASCatch_Failure.hxx \ - CASCatch_CatchSignals.hxx \ - CASCatch_ErrorHandler.hxx +EXPORT_HEADERS= CASCatch_CatchSignals.hxx + # CASCatch_Failure.hxx \ + # CASCatch_ErrorHandler.hxx # Libraries targets LIB = libCASCatch.la -LIB_SRC = CASCatch_Failure.cxx \ - CASCatch_ErrorHandler.cxx \ - CASCatch_CatchSignals.cxx +LIB_SRC = CASCatch_CatchSignals.cxx + # CASCatch_Failure.cxx \ + # CASCatch_ErrorHandler.cxx CPPFLAGS += $(OCC_INCLUDES) CXXFLAGS += $(OCC_CXXFLAGS) LDFLAGS+= $(CAS_KERNEL) $(CAS_MATH) -@CONCLUDE@ - - +@CONCLUDE@ \ No newline at end of file