mirror of
https://github.com/FirebirdSQL/firebird.git
synced 2025-01-22 14:43:03 +01:00
Merge pull request #8080 from FirebirdSQL/work/gh-8079
Fix for bug #8079 : Engine could crash when executing some trigger(s) while another attachment modifies them
This commit is contained in:
commit
d369e2ec26
@ -1289,7 +1289,7 @@ void EXE_execute_triggers(thread_db* tdbb,
|
||||
* if any blow up.
|
||||
*
|
||||
**************************************/
|
||||
if (!*triggers)
|
||||
if (!*triggers || (*triggers)->isEmpty())
|
||||
return;
|
||||
|
||||
SET_TDBB(tdbb);
|
||||
@ -1297,7 +1297,7 @@ void EXE_execute_triggers(thread_db* tdbb,
|
||||
Request* const request = tdbb->getRequest();
|
||||
jrd_tra* const transaction = request ? request->req_transaction : tdbb->getTransaction();
|
||||
|
||||
TrigVector* vector = *triggers;
|
||||
RefPtr<TrigVector> vector(*triggers);
|
||||
Record* const old_rec = old_rpb ? old_rpb->rpb_record : NULL;
|
||||
Record* const new_rec = new_rpb ? new_rpb->rpb_record : NULL;
|
||||
|
||||
@ -1422,15 +1422,9 @@ void EXE_execute_triggers(thread_db* tdbb,
|
||||
|
||||
trigger = NULL;
|
||||
}
|
||||
|
||||
if (vector != *triggers)
|
||||
MET_release_triggers(tdbb, &vector, true);
|
||||
}
|
||||
catch (const Exception& ex)
|
||||
{
|
||||
if (vector != *triggers)
|
||||
MET_release_triggers(tdbb, &vector, true);
|
||||
|
||||
if (trigger)
|
||||
{
|
||||
EXE_unwind(tdbb, trigger);
|
||||
|
@ -9858,6 +9858,8 @@ void TrigVector::release()
|
||||
|
||||
void TrigVector::release(thread_db* tdbb)
|
||||
{
|
||||
fb_assert(useCount.value() > 0);
|
||||
|
||||
if (--useCount == 0)
|
||||
{
|
||||
decompile(tdbb);
|
||||
|
@ -1883,6 +1883,7 @@ void MET_load_ddl_triggers(thread_db* tdbb)
|
||||
|
||||
attachment->att_ddl_triggers = FB_NEW_POOL(*attachment->att_pool)
|
||||
TrigVector(*attachment->att_pool);
|
||||
attachment->att_ddl_triggers->addRef();
|
||||
|
||||
AutoRequest trigger_request;
|
||||
|
||||
|
Loading…
Reference in New Issue
Block a user