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

Follow Alex commit de15522f (Fixed #6886: Different interfaces behavior depending upon source of interface).

This should fix numerous crashes shown by fb-tests.

(cherry picked from commit e5e60d2927)
This commit is contained in:
Vlad Khorsun 2021-08-22 01:07:42 +03:00 committed by AlexPeshkoff
parent 11712f8203
commit ef80bebc55

View File

@ -209,7 +209,7 @@ void InternalConnection::doDetach(thread_db* tdbb)
FbLocalStatus status;
RefPtr<JAttachment> att = m_attachment;
m_attachment = NULL;
m_attachment = NULL; // release and nullify
{ // scope
EngineCallbackGuard guard(tdbb, *this, FB_FUNCTION);
@ -369,7 +369,7 @@ void InternalTransaction::doCommit(FbStatusVector* status, thread_db* tdbb, bool
if (m_scope == traCommon && m_IntConnection.isCurrent())
{
if (!retain) {
m_transaction = NULL;
m_transaction = NULL; // release and nullify
}
}
else
@ -380,7 +380,10 @@ void InternalTransaction::doCommit(FbStatusVector* status, thread_db* tdbb, bool
if (retain)
m_transaction->commitRetaining(&s);
else
{
m_transaction->commit(&s);
m_transaction.clear();
}
}
}
@ -390,14 +393,14 @@ void InternalTransaction::doRollback(FbStatusVector* status, thread_db* tdbb, bo
if (m_connection.isBroken())
{
m_transaction = NULL;
m_transaction.clear();
return;
}
if (m_scope == traCommon && m_IntConnection.isCurrent())
{
if (!retain) {
m_transaction = NULL;
m_transaction = NULL; // release and nullify
}
}
else
@ -408,12 +411,15 @@ void InternalTransaction::doRollback(FbStatusVector* status, thread_db* tdbb, bo
if (retain)
m_transaction->rollbackRetaining(&s);
else
{
m_transaction->rollback(&s);
m_transaction.clear();
}
}
if ((status->getErrors()[1] == isc_att_shutdown || status->getErrors()[1] == isc_shutdown) && !retain)
{
m_transaction = NULL;
m_transaction.clear();
status->init();
}
}
@ -618,7 +624,7 @@ void InternalStatement::doOpen(thread_db* tdbb)
if (m_cursor)
{
m_cursor->close(&status);
m_cursor = NULL;
m_cursor.clear();
}
fb_assert(m_inMetadata->getMessageLength() == m_in_buffer.getCount());
@ -661,9 +667,11 @@ void InternalStatement::doClose(thread_db* tdbb, bool drop)
EngineCallbackGuard guard(tdbb, *this, FB_FUNCTION);
if (m_cursor)
{
m_cursor->close(&status);
m_cursor.clear();
}
m_cursor = NULL;
if (status->getState() & IStatus::STATE_ERRORS)
{
raise(&status, tdbb, "JResultSet::close");
@ -672,10 +680,12 @@ void InternalStatement::doClose(thread_db* tdbb, bool drop)
if (drop)
{
if (m_request)
{
m_request->free(&status);
m_request.clear();
}
m_allocated = false;
m_request = NULL;
if (status->getState() & IStatus::STATE_ERRORS)
{
@ -835,7 +845,7 @@ void InternalBlob::close(thread_db* tdbb)
{
EngineCallbackGuard guard(tdbb, m_connection, FB_FUNCTION);
m_blob->close(&status);
m_blob = NULL;
m_blob.clear();
}
if (status->getState() & IStatus::STATE_ERRORS)
@ -855,7 +865,7 @@ void InternalBlob::cancel(thread_db* tdbb)
{
EngineCallbackGuard guard(tdbb, m_connection, FB_FUNCTION);
m_blob->cancel(&status);
m_blob = NULL;
m_blob.clear();
}
if (status->getState() & IStatus::STATE_ERRORS)