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

Fixed CORE-5645 - Wrong transaction can be passed to external engine.

This commit is contained in:
Adriano dos Santos Fernandes 2017-10-26 15:13:41 +00:00
parent b6b61218b2
commit 4226f7cb4b
2 changed files with 4 additions and 9 deletions

View File

@ -630,21 +630,16 @@ void ExtEngineManager::ExternalContextImpl::releaseTransaction()
void ExtEngineManager::ExternalContextImpl::setTransaction(thread_db* tdbb)
{
jrd_tra* newTransaction = tdbb->getTransaction();
ITransaction* newTransaction = tdbb->getTransaction() ? tdbb->getTransaction()->getInterface(true) : NULL;
if (newTransaction == internalTransaction)
return;
releaseTransaction();
fb_assert(!externalTransaction);
fb_assert(!externalTransaction && !internalTransaction);
if ((internalTransaction = newTransaction))
{
internalTransaction->getInterface(true)->addRef();
externalTransaction = MasterInterfacePtr()->registerTransaction(externalAttachment,
internalTransaction->getInterface(true));
}
externalTransaction = MasterInterfacePtr()->registerTransaction(externalAttachment, internalTransaction);
}
IMaster* ExtEngineManager::ExternalContextImpl::getMaster()

View File

@ -166,7 +166,7 @@ private:
private:
Firebird::IExternalEngine* engine;
Attachment* internalAttachment;
jrd_tra* internalTransaction;
Firebird::ITransaction* internalTransaction;
Firebird::IAttachment* externalAttachment;
Firebird::ITransaction* externalTransaction;
Firebird::GenericMap<Firebird::NonPooled<int, void*> > miscInfo;