diff --git a/interpreter/cling/lib/Interpreter/LookupHelper.cpp b/interpreter/cling/lib/Interpreter/LookupHelper.cpp index 49bb135160f4e26243c130003f9b8081440d8fd9..936da38f8895866e5e67945a8225b55c6ca9e736 100644 --- a/interpreter/cling/lib/Interpreter/LookupHelper.cpp +++ b/interpreter/cling/lib/Interpreter/LookupHelper.cpp @@ -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; }