mirror of
https://git.salome-platform.org/gitpub/modules/smesh.git
synced 2025-02-06 02:14:16 +05:00
To improve SALOME signal handling.
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
This commit is contained in:
parent
5a2bc9cd64
commit
5852d3de51
@ -27,10 +27,8 @@
|
||||
// $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" );
|
||||
|
@ -33,20 +33,16 @@
|
||||
#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;
|
||||
|
@ -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;
|
||||
}
|
||||
|
Loading…
Reference in New Issue
Block a user