mirror of
https://github.com/FirebirdSQL/firebird.git
synced 2025-01-22 18:03:03 +01:00
Fix problem found by Dmitry where node->getDesc is called after parts of csb is released.
This commit is contained in:
parent
10cbd12c0e
commit
446d4fa392
@ -226,7 +226,7 @@ Statement::Statement(thread_db* tdbb, MemoryPool* p, CompilerScratch* csb)
|
||||
}
|
||||
|
||||
// Turn a parsed scratch into a statement.
|
||||
Statement* Statement::makeStatement(thread_db* tdbb, CompilerScratch* csb, bool internalFlag)
|
||||
Statement* Statement::makeStatement(thread_db* tdbb, CompilerScratch* csb, bool internalFlag, dsc* exprDesc)
|
||||
{
|
||||
DEV_BLKCHK(csb, type_csb);
|
||||
SET_TDBB(tdbb);
|
||||
@ -306,6 +306,12 @@ Statement* Statement::makeStatement(thread_db* tdbb, CompilerScratch* csb, bool
|
||||
|
||||
const auto pool = tdbb->getDefaultPool();
|
||||
|
||||
if (exprDesc)
|
||||
{
|
||||
fb_assert(csb->csb_node->getKind() == DmlNode::KIND_VALUE);
|
||||
static_cast<ValueExprNode*>(csb->csb_node)->getDesc(tdbb, csb, exprDesc);
|
||||
}
|
||||
|
||||
statement = FB_NEW_POOL(*pool) Statement(tdbb, pool, csb);
|
||||
|
||||
tdbb->setRequest(old_request);
|
||||
|
@ -45,7 +45,7 @@ private:
|
||||
Statement(thread_db* tdbb, MemoryPool* p, CompilerScratch* csb);
|
||||
|
||||
public:
|
||||
static Statement* makeStatement(thread_db* tdbb, CompilerScratch* csb, bool internalFlag);
|
||||
static Statement* makeStatement(thread_db* tdbb, CompilerScratch* csb, bool internalFlag, dsc* exprDesc = nullptr);
|
||||
static Request* makeRequest(thread_db* tdbb, CompilerScratch* csb, bool internalFlag);
|
||||
|
||||
StmtNumber getStatementId() const
|
||||
|
@ -2760,8 +2760,11 @@ static bool create_expression_index(thread_db* tdbb, SSHORT phase, DeferredWork*
|
||||
{
|
||||
idx.idx_expression = static_cast<ValueExprNode*>(MET_get_dependencies(
|
||||
tdbb, relation, NULL, 0, NULL, &IDX.RDB$EXPRESSION_BLR,
|
||||
&idx.idx_expression_statement, &csb, work->dfw_name, obj_expression_index, 0,
|
||||
nullptr, &csb, work->dfw_name, obj_expression_index, 0,
|
||||
transaction));
|
||||
|
||||
idx.idx_expression_statement = Statement::makeStatement(tdbb, csb, false,
|
||||
&idx.idx_expression_desc);
|
||||
}
|
||||
} // end scope
|
||||
|
||||
@ -2769,7 +2772,6 @@ static bool create_expression_index(thread_db* tdbb, SSHORT phase, DeferredWork*
|
||||
|
||||
idx.idx_count = 1;
|
||||
idx.idx_flags |= idx_expressn;
|
||||
idx.idx_expression->getDesc(tdbb, csb, &idx.idx_expression_desc);
|
||||
idx.idx_rpt[0].idx_itype =
|
||||
DFW_assign_index_type(tdbb, work->dfw_name,
|
||||
idx.idx_expression_desc.dsc_dtype,
|
||||
|
@ -2620,16 +2620,17 @@ void MET_lookup_index_expression(thread_db* tdbb, jrd_rel* relation, index_desc*
|
||||
|
||||
{ // scope
|
||||
Jrd::ContextPoolHolder context(tdbb, attachment->createPool());
|
||||
|
||||
idx->idx_expression = static_cast<ValueExprNode*>(MET_parse_blob(
|
||||
tdbb, relation, &IDX.RDB$EXPRESSION_BLR, &csb,
|
||||
&idx->idx_expression_statement, false, false));
|
||||
nullptr, false, false));
|
||||
|
||||
idx->idx_expression_statement = Statement::makeStatement(tdbb, csb, false,
|
||||
&idx->idx_expression_desc);
|
||||
} // end scope
|
||||
}
|
||||
END_FOR
|
||||
|
||||
if (csb)
|
||||
idx->idx_expression->getDesc(tdbb, csb, &idx->idx_expression_desc);
|
||||
|
||||
delete csb;
|
||||
|
||||
// if there is no existing index block for this index, create
|
||||
|
Loading…
Reference in New Issue
Block a user