Skip to content

Commit

Permalink
[cling] LookupHelper must not unload Transactions:
Browse files Browse the repository at this point in the history
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 root-project#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.
  • Loading branch information
Axel-Naumann committed Apr 2, 2021
1 parent 4e4fac2 commit 0202a4b
Showing 1 changed file with 5 additions and 1 deletion.
6 changes: 5 additions & 1 deletion interpreter/cling/lib/Interpreter/LookupHelper.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -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;
}
Expand Down

0 comments on commit 0202a4b

Please sign in to comment.