TPad changes cause segmentation violation

Hi rooters,
I am trying to do a sort of interactive fitter and I have some problems with a TPad.

I have a Canvas with two TPad of different size on it. The idea is to plot the signal to be fit on the upper and bigger one and the residuals on the lower and smaller pad.
The signals I am using come from a TList and I have “Next” and “Previous” buttons to scroll through the list.

When I start my gui everything is working fine: the selected signal is drawn on the upper pad, the fit works perfectly and the fitted function is shown above the signal and the residual plot appears in the lower pad.
The problem comes when after the fit and the residual plot appearance I try to change the signal I want to fit.
At this point I get a segmentation violation.

Digging into it I found out that it is in some way due to the way in which I draw and make active the lower pad.
If I do:

pad->Draw();
pad->cd();

the residual plot appear the first time and as soon as I change the event I get the segmentation violation;

If I do:

pad->cd();
pad->Draw();

the residual plot is never appearing and I never get the segmentation violation.

Do you have some ideas?

Cheers,
mmoo

Try to add canvas->Modified(); canvas->Update(); after every pad->cd();.

It is not working: nothing change unfortunately!

On which kind of machine are ou working ? with which ROOT version ?

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