Dear experts
I want to manage some TFile
by a static map created myself, so I need to remove them from gROOT’s control. Here is what I do:
fFile=TFile::Open(filename.c_str(), mode.c_str());
fTree = new TTree(name, description);
fTree->SetDirectory(fFile);
fTree->SetAutoSave(100);
//Set branches here
gROOT->GetListOfFiles()->Remove(fFile);
//something
fFile->cd();
fTree->Write();
fFile->Close();
segfault occurs at Write()
, where debug message are
Program received signal SIGSEGV, Segmentation fault.
0x00007fffbd874b5a in TClass::GetBaseClassOffset (isDerivedObject=true, address=0x0, toBase=0x1e269d0, this=0x35cc8c0)
at /.../ROOT/root_v6.24.02/core/meta/src/TClass.cxx:2791
2791 return gCling->ClassInfo_GetBaseOffset(derived, base, address, isDerivedObject);
Missing separate debuginfos, use: dnf debuginfo-install ftgl-2.1.3-0.27.rc5.el9.x86_64 glib2-2.68.4-14.el9_4.1.x86_64 glibc-2.34-100.el9_4.3.x86_64 graphite2-1.3.14-9.el9.x86_64 harfbuzz-2.7.4-8.el9.x86_64 libGLEW-2.2.0-2.el9.x86_64 libXmu-1.1.3-8.el9.x86_64 libXt-1.2.0-6.el9.x86_64 libbrotli-1.0.9-6.el9.x86_64 libuuid-2.37.4-18.el9.x86_64 libxml2-2.9.13-4.el9.x86_64 lz4-libs-1.9.3-5.el9.x86_64 openssl-libs-3.2.2-6.el9_5.x86_64 sssd-client-2.9.5-4.el9_5.1.x86_64 xxhash-libs-0.8.2-1.el9.x86_64
(gdb) backtrace
#0 0x00007fffbd874b5a in TClass::GetBaseClassOffset (isDerivedObject=true, address=0x0, toBase=0x1e269d0,
this=0x35cc8c0)
at /.../ROOT/root_v6.24.02/core/meta/src/TClass.cxx:2791
#1 TClass::GetBaseClassOffset (this=this@entry=0x35cc8c0, toBase=toBase@entry=0x1e269d0, address=address@entry=0x0,
isDerivedObject=isDerivedObject@entry=true)
at /.../ROOT/root_v6.24.02/core/meta/src/TClass.cxx:2769
#2 0x00007fffbd2d835a in TBufferIO::WriteObjectAny (cacheReuse=<optimized out>, ptrClass=0x1e269d0, obj=0x329f790,
this=0x46f7ca10)
at /.../ROOT/root_v6.24.02/io/io/src/TBufferIO.cxx:518
#3 TBufferIO::WriteObjectAny (this=0x46f7ca10, obj=0x329f790, ptrClass=0x1e269d0, cacheReuse=<optimized out>)
at /.../ROOT/root_v6.24.02/io/io/src/TBufferIO.cxx:492
#4 0x00007fffbd83efdd in operator<< <TObject> (obj=0x329f790, buf=...)
at /.../ROOT/root_v6.24.02/core/base/inc/TBuffer.h:402
#5 TObjArray::Streamer (this=0x2ca3b18, b=...)
at /.../ROOT/root_v6.24.02/core/cont/src/TObjArray.cxx:487
#6 0x00007fffbd2cbaf3 in TClass::Streamer (onfile_class=0x0, b=..., obj=0x2ca3b18, this=0x1e448f0)
at /.../ROOT/root_v6.24.02/core/meta/inc/TClass.h:609
#7 TBufferFile::WriteFastArray (streamer=0x0, n=1, cl=0x1e448f0, start=<optimized out>, this=0x46f7ca10)
at /.../ROOT/root_v6.24.02/io/io/src/TBufferFile.cxx:2255
#8 TBufferFile::WriteFastArray (this=0x46f7ca10, start=<optimized out>, cl=0x1e448f0, n=1, streamer=<optimized out>)
at /.../ROOT/root_v6.24.02/io/io/src/TBufferFile.cxx:2242
#9 0x00007fffbd543956 in TStreamerInfo::WriteBufferAux<char**> (this=0x1fdb5b0, b=...,
arr=@0x7fffffffb808: 0x7fffffffb800, compinfo=0x35c9a28, first=first@entry=0, last=last@entry=1, narr=1,
eoffset=0, arrayMode=0)
at /.../ROOT/root_v6.24.02/io/io/src/TStreamerInfoWriteBuffer.cxx:628
#10 0x00007fffbd3997cd in TStreamerInfoActions::GenericWriteAction (buf=..., addr=<optimized out>,
config=<optimized out>)
at /.../ROOT/root_v6.24.02/io/io/src/TStreamerInfoActions.cxx:201
#11 0x00007fffbd2d1525 in TStreamerInfoActions::TConfiguredAction::operator() (object=0x2ca39c0, buffer=..., this=
0x35c6950)
at /.../ROOT/root_v6.24.02/io/io/inc/TStreamerInfoActions.h:123
#12 TBufferFile::ApplySequence (obj=0x2ca39c0, sequence=..., this=0x46f7ca10)
at /.../ROOT/root_v6.24.02/io/io/src/TBufferFile.cxx:3572
#13 TBufferFile::WriteClassBuffer (this=0x46f7ca10, cl=0x2cd48b0, pointer=0x2ca39c0)
at /.../ROOT/root_v6.24.02/io/io/src/TBufferFile.cxx:3541
#14 0x00007fffbd373ccc in TKey::TKey (this=this@entry=0x477c74c0, obj=obj@entry=0x2ca39c0,
name=name@entry=0x2ca39d9 "RooTrackerTree", bufsize=bufsize@entry=35872, motherDir=motherDir@entry=0x1fb8f40)
at /.../ROOT/root_v6.24.02/io/io/src/TKey.cxx:249
#15 0x00007fffbd332605 in TFile::CreateKey (this=<optimized out>, mother=0x1fb8f40, obj=0x2ca39c0,
name=0x2ca39d9 "RooTrackerTree", bufsize=35872)
at /.../ROOT/root_v6.24.02/io/io/src/TFile.cxx:979
#16 0x00007fffbd323fd5 in TDirectoryFile::WriteTObject (this=0x1fb8f40, obj=0x2ca39c0, name=<optimized out>,
option=<optimized out>, bufsize=0)
at /.../ROOT/root_v6.24.02/io/io/src/TDirectoryFile.cxx:19
#17 0x00007fffbd7c24da in TObject::Write (this=0x2ca39c0, name=0x0, option=<optimized out>, bufsize=0) at /xxx/ROOT/root_v6.24.02/core/base/src/TObject.cxx:784
What should I do?