Skip to content

Commit f72de83

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 85d7ab6 commit f72de83

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
@@ -70,6 +70,12 @@ void ProcedureScan::open(thread_db* tdbb) const
7070

7171
const_cast<jrd_prc*>(m_procedure)->checkReload(tdbb);
7272

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

@@ -226,6 +232,8 @@ bool ProcedureScan::getRecord(thread_db* tdbb) const
226232

227233
trace.fetch(false, ITracePlugin::RESULT_SUCCESS);
228234

235+
fb_assert(m_format == m_procedure->prc_record_format);
236+
229237
for (USHORT i = 0; i < m_format->fmt_count; i++)
230238
{
231239
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
@@ -137,7 +137,7 @@ namespace Jrd
137137

138138
protected:
139139
const StreamType m_stream;
140-
const Format* const m_format;
140+
mutable const Format* m_format;
141141
};
142142

143143

0 commit comments

Comments
 (0)