LookupHelper must not unload Transactions:

Outer RAIIs might still reference the Transaction, and unload is
assuming that it owns the transaction and can delete it / put it
into the TransactionPool.

This fixes https://github.com/root-project/root/issues/7657

We still need to track ownership as what has happened here (unload
of a Transaction held by an RAII) can happen again / elsewhere.
This will be addressed by a subsequent PR in master.
This commit is contained in:
Axel Naumann 2021-04-01 12:24:13 +02:00 committed by jenkins
parent 4edb1ed0f2
commit 9432fb6582

View File

@ -722,7 +722,11 @@ namespace cling {
// in invalid state. We should be unloading all of them, i.e. inload the
// current (possibly nested) transaction.
auto *T = const_cast<Transaction*>(m_Interpreter->getCurrentTransaction());
m_Interpreter->unload(*T);
// Must not unload the Transaction, which might delete
// it: the RAII above still points to it! Instead, just
// mark it as "erroneous" which causes the RAII to
// unload it in due time.
T->setIssuedDiags(Transaction::kErrors);
*setResultType = nullptr;
return 0;
}