From d0a79a0f4b1e7137d0cd4a249840f3edfce49dcd Mon Sep 17 00:00:00 2001
From: Axel Naumann <Axel.Naumann@cern.ch>
Date: Wed, 31 Mar 2021 15:10:21 +0200
Subject: [PATCH] [cling] Assert released transaction is != last in pool:

a cheap way to notice what went wrong in https://github.com/root-project/root/issues/7657.
---
 interpreter/cling/lib/Interpreter/TransactionPool.h | 2 ++
 1 file changed, 2 insertions(+)

diff --git a/interpreter/cling/lib/Interpreter/TransactionPool.h b/interpreter/cling/lib/Interpreter/TransactionPool.h
index d2cb4d7489d..5c3f0ade2f8 100644
--- a/interpreter/cling/lib/Interpreter/TransactionPool.h
+++ b/interpreter/cling/lib/Interpreter/TransactionPool.h
@@ -58,6 +58,8 @@ namespace cling {
     // Transaction T must be from call to TransactionPool::takeTransaction
     //
     void releaseTransaction(Transaction* T, bool reuse = true) {
+      assert((m_Transactions.empty() || m_Transactions.back() != T) \
+             && "Transaction already in pool");
       if (reuse) {
         assert((T->getState() == Transaction::kCompleted ||
                 T->getState() == Transaction::kRolledBack)
-- 
GitLab