From 343e60c8060a900f0c27078e7c972d001591d2c6 Mon Sep 17 00:00:00 2001
From: sgorbuno <se.gorbunov@gsi.de>
Date: Fri, 25 Sep 2020 16:57:05 +0000
Subject: [PATCH] do not register CbmQaCanvas in the global list of canvases

---
 core/qa/CbmQaCanvas.h | 4 ++++
 1 file changed, 4 insertions(+)

diff --git a/core/qa/CbmQaCanvas.h b/core/qa/CbmQaCanvas.h
index d88209aa46..d24d08a3b3 100644
--- a/core/qa/CbmQaCanvas.h
+++ b/core/qa/CbmQaCanvas.h
@@ -48,6 +48,10 @@ private:
   /// Constructor which calls TCanvas constructor and restores the bach mode
   template<typename... Types>
   CbmQaCanvas(MyBoolean oldBatchMode, Types... args) : TCanvas(args...) {
+    // prevent automatic deletion of this canvas
+    // when another canvas with the same name is created somewhere else
+    gROOT->GetListOfCanvases()->Remove(this);
+    // reset the batch mode to its original value
     gROOT->SetBatch((Bool_t) oldBatchMode);
   }
 
-- 
GitLab