Hi I'm using TNamed ject (TH1D) in my code. I want to copy and rename them. you can find below an example of segmentation violation error I get. I get an eror on both Linux (compile with g++) an HP (compile with aCC) It Crash in first loop. It pass first loop if i comment out first SetObject statement but it crash in second loop It pass second loop if i comment out second SetObject statement Is there a bug on SetObject or am i doing something wrong ? Laurent Conin Ps; my Root version is 2.22/10 #include <strstream.h> #include "TROOT.h" #include "TH1.h" int main(){ TROOT HbtRoot("Test", "Test"); TH1D* test=new TH1D("test","test",100,0.,1.); test->SetObject("test_b","test_b"); // first SetObject test->Delete(); cout << "first loop OK" << endl; TH1D **test2=new TH1D*[1000]; strstream *str; int i; // first loop for(i=0;i<1000;i++) { str=new strstream; *str << "test2_" << i ; cout <<str->str()<< endl; test2[i]=new TH1D(str->str(),str->str(),100,0.,1.); *str << "_b"; test2[i]->SetObject(str->str(),str->str()); //Second SetObject delete str; }; //second loop for(i=0;i<1000;i++) { cout << i << endl;test2[i]->Delete();} delete [] test2; }
This archive was generated by hypermail 2b29 : Tue Jan 02 2001 - 11:50:18 MET