Hi Frank,
Your job crsahes because the return of CloneTree is null.
I will modify the logic to allow CloneTree on an empty Tree.
Meanwhile replace
TTree *tree2 = tree1->CloneTree(0);
tree2->SetName("tree2");
by
TTree *tree2 = (TTree*)tree1->Clone("tree2")
Rene Brun
On Fri, 3 Sep
2004, Frank Winklmeier wrote:
> Hi,
>
> first here is my exact configuration:
> - OS: Red Hat Enterprise Linux WS release 3 (Taroon Update 2)
> - ROOT: Intel x86 Linux for Redhat RHEL 3 (SLC3) and gcc 3.2.3,
> version 4.00/08
> (ftp://root.cern.ch/root/root_v4.00.08.Linux.RH7.3-slc3.gcc3.2.3.tar.gz)
> - gcc: gcc version 3.2.3 20030502 (Red Hat Linux 3.2.3-34)
>
> and I have the following small program:
>
> #setName.C
> #include "TTree.h"
>
> int main() {
> TTree *tree1 = new TTree();
> tree1->SetName("tree1");
> TTree *tree2 = tree1->CloneTree(0);
> tree2->SetName("tree2");
> }
>
> I compile it with
> gcc -ggdb `root-config --cflags --libs` setName.C
> and run a.out. I get the following seg fault:
>
> *** Break *** segmentation violation
> Generating stack trace...
> 0xb6405768 in __libc_start_main + 0xf8 from /lib/tls/libc.so.6
> 0x08048fad in dl_iterate_phdr + 0x31 from a.out
>
> Using gdb gives:
>
> [Thread debugging using libthread_db enabled]
> [New Thread -1240223072 (LWP 26487)]
>
> Program received signal SIGSEGV,
> Segmentation fault. [Switching to Thread -1240223072 (LWP 26487)]
> 0x080490fe in main () at setName.C:8
> 8 tree2->SetName("tree2");
> (gdb)
>
>
> Somehow SetName() of the cloned tree produces the seg fault. Any
> advice/workaround for that?
>
> Thanks a lot,
> Frank
>
>
This archive was generated by hypermail 2b29 : Sun Jan 02 2005 - 05:50:09 MET