mirror of
https://gitlab.com/kicad/code/kicad.git
synced 2025-09-14 10:13:19 +02:00
Thread safety.
(cherry picked from commit a1c26e45169971020cac3575b1dd336088b8dab4)
This commit is contained in:
parent
29d34a6e4d
commit
2bd6e11dc0
@ -93,11 +93,20 @@ static const wxString formatOpName( int op )
|
|||||||
}
|
}
|
||||||
simpleOps[] =
|
simpleOps[] =
|
||||||
{
|
{
|
||||||
{ TR_OP_MUL, "MUL" }, { TR_OP_DIV, "DIV" }, { TR_OP_ADD, "ADD" },
|
{ TR_OP_MUL, "MUL" },
|
||||||
{ TR_OP_SUB, "SUB" }, { TR_OP_LESS, "LESS" }, { TR_OP_GREATER, "GREATER" },
|
{ TR_OP_DIV, "DIV" },
|
||||||
{ TR_OP_LESS_EQUAL, "LESS_EQUAL" }, { TR_OP_GREATER_EQUAL, "GREATER_EQUAL" },
|
{ TR_OP_ADD, "ADD" },
|
||||||
{ TR_OP_EQUAL, "EQUAL" }, { TR_OP_NOT_EQUAL, "NEQUAL" }, { TR_OP_BOOL_AND, "AND" },
|
{ TR_OP_SUB, "SUB" },
|
||||||
{ TR_OP_BOOL_OR, "OR" }, { TR_OP_BOOL_NOT, "NOT" }, { -1, "" }
|
{ TR_OP_LESS, "LESS" },
|
||||||
|
{ TR_OP_GREATER, "GREATER" },
|
||||||
|
{ TR_OP_LESS_EQUAL, "LESS_EQUAL" },
|
||||||
|
{ TR_OP_GREATER_EQUAL, "GREATER_EQUAL" },
|
||||||
|
{ TR_OP_EQUAL, "EQUAL" },
|
||||||
|
{ TR_OP_NOT_EQUAL, "NEQUAL" },
|
||||||
|
{ TR_OP_BOOL_AND, "AND" },
|
||||||
|
{ TR_OP_BOOL_OR, "OR" },
|
||||||
|
{ TR_OP_BOOL_NOT, "NOT" },
|
||||||
|
{ -1, "" }
|
||||||
};
|
};
|
||||||
|
|
||||||
for( int i = 0; simpleOps[i].op >= 0; i++ )
|
for( int i = 0; simpleOps[i].op >= 0; i++ )
|
||||||
@ -1267,8 +1276,6 @@ void UOP::Exec( CONTEXT* ctx )
|
|||||||
|
|
||||||
VALUE* UCODE::Run( CONTEXT* ctx )
|
VALUE* UCODE::Run( CONTEXT* ctx )
|
||||||
{
|
{
|
||||||
static VALUE g_false( 0 );
|
|
||||||
|
|
||||||
try
|
try
|
||||||
{
|
{
|
||||||
for( UOP* op : m_ucode )
|
for( UOP* op : m_ucode )
|
||||||
@ -1277,7 +1284,8 @@ VALUE* UCODE::Run( CONTEXT* ctx )
|
|||||||
catch(...)
|
catch(...)
|
||||||
{
|
{
|
||||||
// rules which fail outright should not be fired
|
// rules which fail outright should not be fired
|
||||||
return &g_false;
|
std::unique_ptr<VALUE> temp_false = std::make_unique<VALUE>( 0 );
|
||||||
|
return ctx->StoreValue( temp_false.get() );
|
||||||
}
|
}
|
||||||
|
|
||||||
if( ctx->SP() == 1 )
|
if( ctx->SP() == 1 )
|
||||||
@ -1293,7 +1301,8 @@ VALUE* UCODE::Run( CONTEXT* ctx )
|
|||||||
wxASSERT( ctx->SP() == 1 );
|
wxASSERT( ctx->SP() == 1 );
|
||||||
|
|
||||||
// non-well-formed rules should not be fired on a release build
|
// non-well-formed rules should not be fired on a release build
|
||||||
return &g_false;
|
std::unique_ptr<VALUE> temp_false = std::make_unique<VALUE>( 0 );
|
||||||
|
return ctx->StoreValue( temp_false.get() );
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
Loading…
x
Reference in New Issue
Block a user