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