8
0
mirror of https://github.com/FirebirdSQL/firebird.git synced 2025-02-02 10:40:38 +01:00

Fixed bug #8079 : Engine could crash when executing some trigger(s) while another attachment modifies them

This commit is contained in:
Vlad Khorsun 2024-04-11 14:22:47 +03:00
parent 0a2fb31dae
commit a580a308c6
2 changed files with 3 additions and 8 deletions

View File

@ -1289,7 +1289,7 @@ void EXE_execute_triggers(thread_db* tdbb,
* if any blow up. * if any blow up.
* *
**************************************/ **************************************/
if (!*triggers) if (!*triggers || (*triggers)->isEmpty())
return; return;
SET_TDBB(tdbb); SET_TDBB(tdbb);
@ -1297,7 +1297,7 @@ void EXE_execute_triggers(thread_db* tdbb,
Request* const request = tdbb->getRequest(); Request* const request = tdbb->getRequest();
jrd_tra* const transaction = request ? request->req_transaction : tdbb->getTransaction(); 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 old_rec = old_rpb ? old_rpb->rpb_record : NULL;
Record* const new_rec = new_rpb ? new_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; trigger = NULL;
} }
if (vector != *triggers)
MET_release_triggers(tdbb, &vector, true);
} }
catch (const Exception& ex) catch (const Exception& ex)
{ {
if (vector != *triggers)
MET_release_triggers(tdbb, &vector, true);
if (trigger) if (trigger)
{ {
EXE_unwind(tdbb, trigger); EXE_unwind(tdbb, trigger);

View File

@ -1883,6 +1883,7 @@ void MET_load_ddl_triggers(thread_db* tdbb)
attachment->att_ddl_triggers = FB_NEW_POOL(*attachment->att_pool) attachment->att_ddl_triggers = FB_NEW_POOL(*attachment->att_pool)
TrigVector(*attachment->att_pool); TrigVector(*attachment->att_pool);
attachment->att_ddl_triggers->addRef();
AutoRequest trigger_request; AutoRequest trigger_request;