Hi Phlip,
You had several typing mistakes in your macro. Here is your macro
modified to run. The main problem was that you forgot the p2->cd()
before drawing the last frame.
You also asked the question:
"Why the interpreter can't warn over missing arguments?"
In TPad::DrawFrame, the last argument is an optional argument.
Rene Brun
{
gROOT -> Reset();
c1 = new TCanvas("c1","",200,10,700,500);
p1 = new TPad("p1","p1",0.0,0.50,1,0.900000,46,3,1);
p1->Draw();
p1->cd();
p1->SetGrid();
p1->DrawFrame (-0.59, -0.06498, 6.542, 0.714);
const Int_t n0 = 6;
Double_t x0[n0] = { 1.0,2.0,3.0,4.0,4.954,5.954 };
Double_t y0[n0] = { 0.2115,0.476,0.565,0.580,0.645,0.649 } ;
TGraph *gr0 = new TGraph(n0,x0,y0);
gr0->Draw("CP");
p1->Modified();
c1->Modified();
c1->cd();
TPad *p2 = new TPad("p2","p2",0.0,0.00,1,0.500000,46,3,1);
p2->Draw();
p2->cd();
p2->DrawFrame (-0.5954, -0.0649, 6.5496, 0.71478);
}
On Wed, 14 Feb 2001, Phlip wrote:
> Rooties:
>
> Here's the macro that crashes:
>
> {
> gROOT -> Reset();
> c1 = new TCanvas("c1","",200,10,700,500);
> p1 = new TPad("p1","p1",0.0,0.50,1,0.900000,46,3,1);
> p1->Draw();
> p1->cd();
> p1->SetGrid();
> p1->DrawFrame (-0.59, -0.06498, 6.542, 0.714);
> const Int_t n0 = 6;
> Double_t x0[n0] = { 1.0,2.0,3.0,4.0,4.954,5.954 },
> y0[n0] = { 0.2115,0.476,0.565,0.580,0.645,0.649 } ;
> gr0 = new TGraph(n0,x0,y0);
> gr0->Draw("CP");
> p1->Modified();
> c1->Modified();
> c1->cd();
> TPad * p2 = new TPad("p2","p2",0.0,0.00,1,0.500000,46,3,1);
> p2->Draw();
> p2->DrawFrame (-0.5954, -0.0649, 6.5496, 0.71478);
> }
>
>
> If I don't disable that last 'DrawFrame' call, it crashes like this:
>
>
> *******************************************
> * *
> * W E L C O M E to R O O T *
> * *
> * Version 2.25/03 14 September 2000 *
> * *
> * You are welcome to visit our Web site *
> * http://root.cern.ch *
> * *
> *******************************************
>
> CINT/ROOT C/C++ Interpreter version 5.14.50, Sep 2 2000
> Type ? for help. Commands must be C++ statements.
> Enclose multiple statements between { }.
> root [0]
> Processing crasher.C...
>
> *** Break *** segmentation violation
> Root > root [1] .q
>
>
> Any clues?
>
> --
> Phlip phlip_cpp@my-deja.com
> ============ http://c2.com/cgi/wiki?PhlIp ============
> -- Founding member of NuGWa -
> Nudists for Global Warming --
>
This archive was generated by hypermail 2b29 : Tue Jan 01 2002 - 17:50:36 MET