[ROOT] TLegend

From: M.R.Sutton (sutt@desy.de)
Date: Thu Nov 02 2000 - 17:00:50 MET


Why might this be giving me a segmentation violation?

      TLegend *tleg = new TLegend(0.2,0.65,0.45,0.85);
      cout << "ptr: " << tleg << endl;
      tleg->SetFillColor(0);
      tleg->SetBorderSize(0);
      tleg->AddEntry(data_dist,"ZEUS 96+97","p");
      tleg->AddEntry(res_dist,"HERWIG (dir + res)","f");
      tleg->AddEntry(dir_dist,"HERWIG direct","f");
      tleg->Draw();

the pointers  {data,dir,res}_dist *are* all defined and plotable
and the objects pointed to *are* in scope as is the pointer
tleg after the declaration, yet still the segmentation violation
occurs.

I have traced it to the Draw command  following the AddEntry.
If I *DO NOT* use AddEntry, then the segmentation violation
does NOT occur. Does this not suggest a problem with the
TList of the TLegend?

Surely if everything properly conforms to the data hiding
paradigm etc then nothing I have done previously should  be
able to stop the TLegend behaving properly and suggests some
hidden dependence on some additional global object which
isn't in the right state?

Or maybe I am just a victim of ignorance and am doing
something wrong?

Unnecessary Dependence on Global Objects? JUST SAY NO!!!!!



This archive was generated by hypermail 2b29 : Tue Jan 02 2001 - 11:50:36 MET