Skip to content
Closed
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
7 changes: 4 additions & 3 deletions io/io/src/TFile.cxx
Original file line number Diff line number Diff line change
Expand Up @@ -2119,7 +2119,6 @@ Int_t TFile::Recover()

if (fWritable && !fFree) fFree = new TList;

TKey *key;
Int_t nrecov = 0;
nwheader = 1024;
Int_t nread = nwheader;
Expand Down Expand Up @@ -2171,14 +2170,16 @@ Int_t TFile::Recover()
TClass *tclass = TClass::GetClass(classname);
if (seekpdir == fSeekDir && tclass && !tclass->InheritsFrom(TFile::Class())
&& strcmp(classname,"TBasket")) {
key = new TKey(this);

TKey *key = new TKey(this);
key->ReadKeyBuffer(bufread);
if (!strcmp(key->GetName(),"StreamerInfo")) {
fSeekInfo = seekkey;
SafeDelete(fInfoCache);
fNbytesInfo = nbytes;
delete key;
} else {
AppendKey(key);
AppendKey(key); // ownership transferred
nrecov++;
SetBit(kRecovered);
Info("Recover", "%s, recovered key %s:%s at address %lld",GetName(),key->GetClassName(),key->GetName(),idcur);
Expand Down
6 changes: 5 additions & 1 deletion tree/dataframe/src/RDFSnapshotHelpers.cxx
Original file line number Diff line number Diff line change
Expand Up @@ -260,7 +260,8 @@ void EnsureValidSnapshotRNTupleOutput(const ROOT::RDF::RSnapshotOptions &opts, c
if (!outFile || outFile->IsZombie())
throw std::invalid_argument("Snapshot: cannot open file \"" + fileName + "\" in update mode");

auto *outNTuple = outFile->Get<ROOT::RNTuple>(ntupleName.c_str());
std::unique_ptr<ROOT::RNTuple> uoNT{outFile->Get<ROOT::RNTuple>(ntupleName.c_str())};
auto *outNTuple = uoNT.get();

if (outNTuple) {
if (opts.fOverwriteIfExists) {
Expand Down Expand Up @@ -534,6 +535,7 @@ void ROOT::Internal::RDF::UntypedSnapshotTTreeHelper::SetEmptyBranches(TTree *in

void ROOT::Internal::RDF::UntypedSnapshotTTreeHelper::Initialize()
{
delete fOutputFile.release(); // delete before create. reset does it the other way round
fOutputFile.reset(
TFile::Open(fFileName.c_str(), fOptions.fMode.c_str(), /*ftitle=*/"",
ROOT::CompressionSettings(fOptions.fCompressionAlgorithm, fOptions.fCompressionLevel)));
Expand Down Expand Up @@ -937,6 +939,8 @@ void ROOT::Internal::RDF::UntypedSnapshotRNTupleHelper::Initialize()
writeOptions.SetEnablePageChecksums(fOptions.fEnablePageChecksums);
writeOptions.SetEnableSamePageMerging(fOptions.fEnableSamePageMerging);

// Delete beforehand (.reset does it in inverse order, creates new and then deletes)
delete fOutputFile.release();
fOutputFile.reset(TFile::Open(fFileName.c_str(), fOptions.fMode.c_str()));
if (!fOutputFile)
throw std::runtime_error("Snapshot: could not create output file " + fFileName);
Expand Down
Loading