diff --git a/src/jrd/extds/InternalDS.cpp b/src/jrd/extds/InternalDS.cpp index 7d9d582cd1..2aeba54223 100644 --- a/src/jrd/extds/InternalDS.cpp +++ b/src/jrd/extds/InternalDS.cpp @@ -209,7 +209,7 @@ void InternalConnection::doDetach(thread_db* tdbb) FbLocalStatus status; RefPtr 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)