Skip to content

Commit 7f71e94

Browse files
committed
Merge pull request #8852 from FirebirdSQL/work/gh-8851
Fixed bug #8851 : 'Internal error' when calling outer procedure after deleting unused result variable from inner procedure
1 parent f784b93 commit 7f71e94

File tree

2 files changed

+9
-1
lines changed

2 files changed

+9
-1
lines changed

src/jrd/recsrc/ProcedureScan.cpp

Lines changed: 8 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -73,6 +73,12 @@ void ProcedureScan::internalOpen(thread_db* tdbb) const
7373

7474
const_cast<jrd_prc*>(m_procedure)->checkReload(tdbb);
7575

76+
// Procedure could be altered and its record format changed since current instance of
77+
// ProcedureScan was created. Here it is not the right place to check if new format is
78+
// compatible with caller's expectations, so we just use correct (possible new) format.
79+
80+
m_format = m_procedure->prc_record_format;
81+
7682
Request* const request = tdbb->getRequest();
7783
Impure* const impure = request->getImpure<Impure>(m_impure);
7884

@@ -230,6 +236,8 @@ bool ProcedureScan::internalGetRecord(thread_db* tdbb) const
230236

231237
trace.fetch(false, ITracePlugin::RESULT_SUCCESS);
232238

239+
fb_assert(m_format == m_procedure->prc_record_format);
240+
233241
for (USHORT i = 0; i < m_format->fmt_count; i++)
234242
{
235243
assignParams(tdbb, &msg_format->fmt_desc[2 * i], &msg_format->fmt_desc[2 * i + 1],

src/jrd/recsrc/RecordSource.h

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -223,7 +223,7 @@ namespace Jrd
223223

224224
protected:
225225
const StreamType m_stream;
226-
const Format* const m_format;
226+
mutable const Format* m_format;
227227
};
228228

229229

0 commit comments

Comments
 (0)