From f1139cc9abb077fe7c4c8e936478b44987c09557 Mon Sep 17 00:00:00 2001 From: dimitr Date: Wed, 11 Dec 2013 17:11:47 +0000 Subject: [PATCH] Protected from unexpected operations with a closed stream. --- src/jrd/recsrc/ConditionalStream.cpp | 17 ++++++++++++----- 1 file changed, 12 insertions(+), 5 deletions(-) diff --git a/src/jrd/recsrc/ConditionalStream.cpp b/src/jrd/recsrc/ConditionalStream.cpp index 096b9b2032..b851c31309 100644 --- a/src/jrd/recsrc/ConditionalStream.cpp +++ b/src/jrd/recsrc/ConditionalStream.cpp @@ -93,6 +93,10 @@ bool ConditionalStream::refetchRecord(thread_db* tdbb) const { jrd_req* const request = tdbb->getRequest(); Impure* const impure = request->getImpure(m_impure); + + if (!(impure->irsb_flags & irsb_open)) + return false; + return impure->irsb_next->refetchRecord(tdbb); } @@ -100,6 +104,10 @@ bool ConditionalStream::lockRecord(thread_db* tdbb) const { jrd_req* const request = tdbb->getRequest(); Impure* const impure = request->getImpure(m_impure); + + if (!(impure->irsb_flags & irsb_open)) + return false; + return impure->irsb_next->lockRecord(tdbb); } @@ -141,13 +149,12 @@ void ConditionalStream::findUsedStreams(StreamList& streams, bool expandAll) con void ConditionalStream::invalidateRecords(jrd_req* request) const { - Impure* const impure = request->getImpure(m_impure); - impure->irsb_next->invalidateRecords(request); + m_first->invalidateRecords(request); + m_second->invalidateRecords(request); } void ConditionalStream::nullRecords(thread_db* tdbb) const { - jrd_req* const request = tdbb->getRequest(); - Impure* const impure = request->getImpure(m_impure); - impure->irsb_next->nullRecords(tdbb); + m_first->nullRecords(tdbb); + m_second->nullRecords(tdbb); }