I have following script that pops up a simple window for plotting different values.
When I run it in root i.e.
it works fine. But when I close it and rerun it in the same interpreter env it crashed.
p.s. script is attached
plot.C (4.92 KB)
If you are using signals/slots communication mechanism you have to either compile your code with ACLiC (.x plot.C++) or restart the root session instead of reloading. It is important to close properly your GUI, if you want to be able to reload it.
In relation to that, I would like to take your attention on the following error: the same layout hints cannot be reused if the Cleanup method will be used for deletion of objects added via AddFrame. The comment of TGCompositeFrame::Cleanup says: “CAUTION: all objects (frames and layout hints) must be unique, i.e. cannot be shared.”. The pointer fL2 in all lines of code similar to:
fF1->AddFrame(fF[i], fL2); should be replaced by a TGLayoutHints object if the Cleanup method will be used:
fF1->AddFrame(fF[i], new TGLayoutHints(kLHintsCenterY | kLHintsLeft, 2, 2, 2, 2)); In addition, I changed the line 158 to ‘plot()’, I used gClient->GetRoot() instead of ‘0’ etc.