TCanvas warning

Hi everyone,

How can I get rid of this message : “Warning in TCanvas::Constructor: Deleting canvas with same name: Event_Display.C – TARGET & SFT” ?

It comes every time I execute my program more than once. I guess it has something to do with memory, but I don’t know what to do.

Thank you very much

TCanvas *c2;
c2 = new TCanvas(“Event_Display.C – TARGET & SFT”,“Event_Display.C – TARGET & SFT”,0,200,1050,700);
c2->Divide(3,2);

Try: TCanvas *c = (TCanvas *)gROOT->GetListOfCanvases()->FindObject("your_canvas_name"); if (c) c->Clear(); // "reuse" the existing one else c = new TCanvas("your_canvas_name", "your canvas title", ...); or: TCanvas *c = (TCanvas *)gROOT->GetListOfCanvases()->FindObject("your_canvas_name"); delete c; // delete the existing one c = new TCanvas("your_canvas_name", "your canvas title", ...);

1 Like

This topic was automatically closed 14 days after the last reply. New replies are no longer allowed.