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

Fixed CORE-5533 - Crash on 3.0 and 4.0 when DB contains database-level trigger.

This commit is contained in:
Adriano dos Santos Fernandes 2017-05-10 15:46:29 +00:00
parent 92d37c8efe
commit 208f24f222
5 changed files with 18 additions and 10 deletions

View File

@ -628,10 +628,10 @@ void ExtEngineManager::ExternalContextImpl::setTransaction(thread_db* tdbb)
if ((internalTransaction = newTransaction))
{
internalTransaction->getInterface()->addRef();
internalTransaction->getInterface(true)->addRef();
externalTransaction = MasterInterfacePtr()->registerTransaction(externalAttachment,
internalTransaction->getInterface());
internalTransaction->getInterface(true));
}
}

View File

@ -283,7 +283,7 @@ void InternalTransaction::doStart(FbStatusVector* status, thread_db* tdbb, Clump
fb_assert(localTran);
if (m_scope == traCommon && m_IntConnection.isCurrent())
m_transaction = localTran->getInterface();
m_transaction = localTran->getInterface(true);
else
{
JAttachment* att = m_IntConnection.getJrdAtt();

View File

@ -4201,9 +4201,17 @@ JTransaction* JAttachment::startTransaction(CheckStatusWrapper* user_status,
successful_completion(user_status);
JTransaction* jt = FB_NEW JTransaction(tra, getStable());
tra->setInterface(jt);
jt->addRef();
JTransaction* jt = tra->getInterface(false);
if (jt)
tra->tra_flags &= ~TRA_own_interface;
else
{
jt = FB_NEW JTransaction(tra, getStable());
tra->setInterface(jt);
jt->addRef();
}
return jt;
}

View File

@ -1291,7 +1291,7 @@ void TRA_release_transaction(thread_db* tdbb, jrd_tra* transaction, Jrd::TraceTr
// Release the transaction and its pool
tdbb->setTransaction(NULL);
JTransaction* jTra = transaction->getInterface();
JTransaction* jTra = transaction->getInterface(true); // ASF: maybe it's better to pass false?
if (jTra)
{
jTra->setHandle(NULL);
@ -3511,9 +3511,9 @@ jrd_tra::~jrd_tra()
}
JTransaction* jrd_tra::getInterface()
JTransaction* jrd_tra::getInterface(bool create)
{
if (!tra_interface)
if (!tra_interface && create)
{
tra_flags |= TRA_own_interface;
tra_interface = FB_NEW JTransaction(this, tra_attachment->getStable());

View File

@ -239,7 +239,7 @@ public:
return tra_attachment->att_dsql_instance;
}
JTransaction* getInterface();
JTransaction* getInterface(bool create);
void setInterface(JTransaction* jt);
FB_API_HANDLE tra_public_handle; // Public handle