I want to write a script does a loop which reads in histograms from a file and plots them on a canvas. My loop also resizes the statistics box of the histogram to make it easier to read. This resizing involves doing a gPad->Update(). On the first loop, this works but on the second loop I get a segfault. I’ve attached a stripped down version of my script which illustrates the problem. I’m using ROOT 5.17/08. Why do I get this segfault?
A secondary question - My method of changing the size of the stats box takes 6 lines of code. Is there an easier way?
Your version was segfaulting because you were creating two canvases with the same name. When creating the second instance, the first one was deleted, making damage in your local variables.