Seg violation with TLegend on cygwin

Hello,
I’m having trouble getting TLegend to work with my installation of root 3.10 on cygwin. I have made a small script that crashes with a segmentation violation on cygwin, but works on linux with root 3.05. Am I doing something stupid or did I find a bug?
Thanks,
Charles

{
   double b0min = 0.0;
   double b0max = 1.0;
   double bMeasMin = 0;
   double bMeasMax = 2.5;
   TCanvas *c1 = new TCanvas;
   TH2F *h2 = new TH2F ("h2", "Feldman Cousins Bands for R", 
                        2, bMeasMin, bMeasMax, 2, b0min, b0max);
   h2->Draw();
   double zerod = 0;
   TGraphErrors *point = 
      new TGraphErrors(1, &zerod, &zerod, &zerod, &zerod);
   point->SetMarkerColor(2);
   point->SetMarkerStyle(20);
   cout << "starting legend" << endl;
   TLegend *legend = new TLegend (0.5, 0.5, 0.8, 0.2);
   legend->AddEntry(point, "Most Likely Value");
   cout << "drawing legend" << endl;
   legend->Draw();
   cout << "drew lengend" << endl;
   h2->Draw("same");
   cout << "printing" << endl;
   c1->Print("try1.eps");
   cout << "printed" << endl;
}

Your macro crashes on my linux as well because:

TLegend *legend = new TLegend (0.5, 0.5, 0.8, 0.2); has wrong margins

TLegend *legend = new TLegend (X1, Y1, X2, Y2);

X and Y are coordinates of left lower and upper right corners of a legend box.

1 values must be smaller than correspongind 2 values

for example

TLegend *legend = new TLegend (0.5, 0.5, 0.8, 0.8);

happens …

smiley showed up somehow instead of a number

TLegend *legend = new TLegend (0.77, 0.7, 0.97, 0.74);

Works much better now. Thanks. :smiley:

In the TLegend constructor x2>x1 and y2>y1
Replace
TLegend *legend = new TLegend (0.5, 0.5, 0.8, 0.2);
by
TLegend *legend = new TLegend (0.5, 0.2, 0.8, 0.5);

I have modified the CVS version to automatically make sure that
x1 <x2 and y1 <y2

Rene