]> SALOME platform Git repositories - modules/smesh.git/commitdiff
Salome HOME
To improve SALOME signal handling.
authorapo <apo@opencascade.com>
Fri, 3 Mar 2006 14:25:21 +0000 (14:25 +0000)
committerapo <apo@opencascade.com>
Fri, 3 Mar 2006 14:25:21 +0000 (14:25 +0000)
Connected to the following bugs.
Bug IPAL11670
   CRASH after trying to import "polygones.med" and "recall_bord.med".
Bug PAL11170
SIGSEGV when "extrusion along a path" gives no result

src/StdMeshers/StdMeshers_Distribution.cxx
src/StdMeshers/StdMeshers_NumberOfSegments.cxx
src/StdMeshersGUI/StdMeshersGUI_DistrPreview.cxx

index 93858296b6bce1a77ea6492b0a75843bc5ae4d6b..01fc5c6f6f6629a6f64c7da809fa480179023118 100644 (file)
 //  $Header$
 
 #include "StdMeshers_Distribution.hxx"
-#include <CASCatch_CatchSignals.hxx>
-#include <CASCatch_Failure.hxx> 
-#include <CASCatch_ErrorHandler.hxx>
-#include <OSD.hxx>
+#include "CASCatch_CatchSignals.hxx"
+
 #include <math_GaussSingleIntegration.hxx>
 #include <utilities.h>
 
@@ -46,7 +44,6 @@ Function::~Function()
 bool Function::value( const double, double& f ) const
 {
   CASCatch_CatchSignals aCatchSignals;
-  aCatchSignals.Activate();
 
   bool ok = true;
   if( myConv==0 )
@@ -55,10 +52,9 @@ bool Function::value( const double, double& f ) const
     {
       f = pow( 10, f );
     }
-    CASCatch_CATCH(CASCatch_Failure)
+    CASCatch_CATCH(Standard_Failure)
     {
-      aCatchSignals.Deactivate();
-      Handle(CASCatch_Failure) aFail = CASCatch_Failure::Caught();
+      Handle(Standard_Failure) aFail = Standard_Failure::Caught();
       f = 0.0;
       ok = false;
     }
@@ -175,7 +171,6 @@ FunctionExpr::FunctionExpr( const char* str, const int conv )
   myValues( 1, 1 )
 {
   CASCatch_CatchSignals aCatchSignals;
-  aCatchSignals.Activate();
 
   bool ok = true;
   CASCatch_TRY
@@ -183,13 +178,11 @@ FunctionExpr::FunctionExpr( const char* str, const int conv )
     myExpr = ExprIntrp_GenExp::Create();
     myExpr->Process( ( Standard_CString )str );
   }
-  CASCatch_CATCH(CASCatch_Failure)
+  CASCatch_CATCH(Standard_Failure)
   {
-    aCatchSignals.Deactivate();
-    Handle(CASCatch_Failure) aFail = CASCatch_Failure::Caught();
+    Handle(Standard_Failure) aFail = Standard_Failure::Caught();
     ok = false;
   }
-  aCatchSignals.Deactivate();
 
   if( !ok || !myExpr->IsDone() )
     myExpr.Nullify();
@@ -214,23 +207,19 @@ bool FunctionExpr::value( const double t, double& f ) const
   if( myExpr.IsNull() )
     return false;
 
-  OSD::SetSignal( true );
   CASCatch_CatchSignals aCatchSignals;
-  aCatchSignals.Activate();
 
   ( ( TColStd_Array1OfReal& )myValues ).ChangeValue( 1 ) = t;
   bool ok = true;
   CASCatch_TRY {
     f = myExpr->Expression()->Evaluate( myVars, myValues );
   }
-  CASCatch_CATCH(CASCatch_Failure) {
-    aCatchSignals.Deactivate();
-    Handle(CASCatch_Failure) aFail = CASCatch_Failure::Caught();
+  CASCatch_CATCH(Standard_Failure) {
+    Handle(Standard_Failure) aFail = Standard_Failure::Caught();
     f = 0.0;
     ok = false;
   }
 
-  aCatchSignals.Deactivate();
   ok = Function::value( t, f ) && ok;
   return ok;
 }
@@ -244,7 +233,7 @@ double FunctionExpr::integral( const double a, const double b ) const
     if( _int.IsDone() )
       res = _int.Value();
   }
-  CASCatch_CATCH(CASCatch_Failure)
+  CASCatch_CATCH(Standard_Failure)
   {
     res = 0.0;
     MESSAGE( "Exception in integral calculating" );
index 139ea22e6c57ec9632ce393da9338c2826057cac..c5eef67000a13c00fe965161792a9b3e4f981b33 100644 (file)
 #include "SMESHDS_SubMesh.hxx"
 #include "SMESH_Mesh.hxx"
 
-#include <CASCatch_CatchSignals.hxx>
-#include <CASCatch_ErrorHandler.hxx>
-#include <CASCatch_Failure.hxx> 
+#include "CASCatch_CatchSignals.hxx"
+
 #include <ExprIntrp_GenExp.hxx>
 #include <Expr_Array1OfNamedUnknown.hxx>
 #include <Expr_NamedUnknown.hxx>
-#include <OSD.hxx>
 #include <TColStd_Array1OfReal.hxx>
 #include <TCollection_AsciiString.hxx>
 #include <TopExp.hxx>
 #include <TopTools_IndexedMapOfShape.hxx>
 
-#include <Standard_ErrorHandler.hxx>
-
 using namespace std;
 
 const double PRECISION = 1e-7;
@@ -216,10 +212,7 @@ void StdMeshers_NumberOfSegments::SetTableFunction(const std::vector<double>& ta
   double prev = -PRECISION;
   bool isSame = table.size() == _table.size();
 
-  OSD::SetSignal( true );
   CASCatch_CatchSignals aCatchSignals;
-  aCatchSignals.Activate();
-
   bool pos = false;
   for (i=0; i < table.size()/2; i++) {
     double par = table[i*2];
@@ -230,10 +223,9 @@ void StdMeshers_NumberOfSegments::SetTableFunction(const std::vector<double>& ta
       {
        val = pow( 10.0, val );
       }
-      CASCatch_CATCH(CASCatch_Failure)
+      CASCatch_CATCH(Standard_Failure)
       {
-       aCatchSignals.Deactivate();
-       Handle(CASCatch_Failure) aFail = CASCatch_Failure::Caught();
+       Handle(Standard_Failure) aFail = Standard_Failure::Caught();
        throw SALOME_Exception( LOCALIZED( "invalid value"));
        return;
       }
@@ -258,7 +250,6 @@ void StdMeshers_NumberOfSegments::SetTableFunction(const std::vector<double>& ta
     }
     prev = par;
   }
-  aCatchSignals.Deactivate();
 
   if( !pos )
     throw SALOME_Exception(LOCALIZED("value of table function is not positive"));
@@ -320,9 +311,7 @@ bool process( const TCollection_AsciiString& str, int convMode,
              bool& non_neg, bool& non_zero,
              bool& singulars, double& sing_point )
 {
-  OSD::SetSignal( true );
   CASCatch_CatchSignals aCatchSignals;
-  aCatchSignals.Activate();
 
   bool parsed_ok = true;
   Handle( ExprIntrp_GenExp ) myExpr;
@@ -331,13 +320,11 @@ bool process( const TCollection_AsciiString& str, int convMode,
     myExpr = ExprIntrp_GenExp::Create();
     myExpr->Process( str.ToCString() );
   }
-  CASCatch_CATCH(CASCatch_Failure)
+  CASCatch_CATCH(Standard_Failure)
   {
-    aCatchSignals.Deactivate();
-    Handle(CASCatch_Failure) aFail = CASCatch_Failure::Caught();
+    Handle(Standard_Failure) aFail = Standard_Failure::Caught();
     parsed_ok = false;
   }
-  aCatchSignals.Deactivate();
 
   syntax = false;
   args = false;
index 0d66dc53aa903a601113b0c772855057ee3a08f0..075f2345d8750f52924bd8d4cf8be67530f42e0c 100644 (file)
@@ -1,11 +1,9 @@
 
 #include "StdMeshersGUI_DistrPreview.h"
+#include "CASCatch_CatchSignals.hxx"
+
 #include <Expr_NamedUnknown.hxx>
 #include <Expr_GeneralExpression.hxx>
-#include <CASCatch_CatchSignals.hxx>
-#include <CASCatch_Failure.hxx> 
-#include <CASCatch_ErrorHandler.hxx>
-#include <OSD.hxx>
 
 StdMeshersGUI_DistrPreview::StdMeshersGUI_DistrPreview( QWidget* p, StdMeshers::StdMeshers_NumberOfSegments_ptr h )
 : QwtPlot( p ),
@@ -223,20 +221,16 @@ void StdMeshersGUI_DistrPreview::update()
   delete[] y;
   x = y = 0;
 
-  OSD::SetSignal( true );
   CASCatch_CatchSignals aCatchSignals;
-  aCatchSignals.Activate();
 
   CASCatch_TRY
   {   
     replot();
   }
-  CASCatch_CATCH(CASCatch_Failure)
+  CASCatch_CATCH(Standard_Failure)
   {
-    aCatchSignals.Deactivate();
-    Handle(CASCatch_Failure) aFail = CASCatch_Failure::Caught();
+    Handle(Standard_Failure) aFail = Standard_Failure::Caught();
   }
-  aCatchSignals.Deactivate();
 }
 
 void StdMeshersGUI_DistrPreview::showError()
@@ -274,7 +268,6 @@ bool isCorrectArg( const Handle( Expr_GeneralExpression )& expr )
 bool StdMeshersGUI_DistrPreview::init( const QString& str )
 {
   CASCatch_CatchSignals aCatchSignals;
-  aCatchSignals.Activate();
 
   bool parsed_ok = true;
   CASCatch_TRY
@@ -282,13 +275,11 @@ bool StdMeshersGUI_DistrPreview::init( const QString& str )
     myExpr = ExprIntrp_GenExp::Create();
     myExpr->Process( ( Standard_CString ) str.latin1() );
   }
-  CASCatch_CATCH(CASCatch_Failure)
+  CASCatch_CATCH(Standard_Failure)
   {
-    aCatchSignals.Deactivate();
-    Handle(CASCatch_Failure) aFail = CASCatch_Failure::Caught();
+    Handle(Standard_Failure) aFail = Standard_Failure::Caught();
     parsed_ok = false;
   }
-  aCatchSignals.Deactivate();
 
   bool syntax = false, args = false;
   if( parsed_ok && myExpr->IsDone() )
@@ -318,23 +309,20 @@ double StdMeshersGUI_DistrPreview::funcValue( const double t, bool& ok )
 
 double StdMeshersGUI_DistrPreview::calc( bool& ok )
 {
-  OSD::SetSignal( true );
   double res = 0.0;
 
   CASCatch_CatchSignals aCatchSignals;
-  aCatchSignals.Activate();
 
   ok = true;
   CASCatch_TRY {   
     res = myExpr->Expression()->Evaluate( myVars, myValues );
   }
-  CASCatch_CATCH(CASCatch_Failure) {
-    aCatchSignals.Deactivate();
-    Handle(CASCatch_Failure) aFail = CASCatch_Failure::Caught();
+  CASCatch_CATCH(Standard_Failure) {
+    Handle(Standard_Failure) aFail = Standard_Failure::Caught();
     ok = false;
     res = 0.0;
   }
-  aCatchSignals.Deactivate();
+
   return res;
 }
 
@@ -346,7 +334,6 @@ bool StdMeshersGUI_DistrPreview::isDone() const
 bool StdMeshersGUI_DistrPreview::convert( double& v ) const
 {
   CASCatch_CatchSignals aCatchSignals;
-  aCatchSignals.Activate();
 
   bool ok = true;
   switch( myConv )
@@ -357,10 +344,9 @@ bool StdMeshersGUI_DistrPreview::convert( double& v ) const
       { 
        v = pow( 10.0, v );
       }
-      CASCatch_CATCH(CASCatch_Failure)
+      CASCatch_CATCH(Standard_Failure)
       {
-       aCatchSignals.Deactivate();
-       Handle(CASCatch_Failure) aFail = CASCatch_Failure::Caught();
+       Handle(Standard_Failure) aFail = Standard_Failure::Caught();
        v = 0.0;
        ok = false;
       }
@@ -372,6 +358,6 @@ bool StdMeshersGUI_DistrPreview::convert( double& v ) const
       v = 0;
     break;
   }
-  aCatchSignals.Deactivate();
+
   return ok;
 }