Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

fix: add missing TFile::Close() to destructors in ROOT writers #1344

Merged
merged 3 commits into from
Jul 26, 2022
Merged
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
4 changes: 3 additions & 1 deletion Examples/Io/Root/src/RootMaterialDecorator.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -352,5 +352,7 @@ ActsExamples::RootMaterialDecorator::RootMaterialDecorator(
}

ActsExamples::RootMaterialDecorator::~RootMaterialDecorator() {
m_inputFile->Close();
if (m_inputFile != nullptr) {
m_inputFile->Close();
}
}
6 changes: 5 additions & 1 deletion Examples/Io/Root/src/RootMaterialTrackWriter.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -95,7 +95,11 @@ ActsExamples::RootMaterialTrackWriter::RootMaterialTrackWriter(
}
}

ActsExamples::RootMaterialTrackWriter::~RootMaterialTrackWriter() = default;
ActsExamples::RootMaterialTrackWriter::~RootMaterialTrackWriter() {
if (m_outputFile != nullptr) {
m_outputFile->Close();
}
}

ActsExamples::ProcessCode ActsExamples::RootMaterialTrackWriter::endRun() {
// write the tree and close the file
Expand Down
6 changes: 5 additions & 1 deletion Examples/Io/Root/src/RootMeasurementWriter.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -78,7 +78,11 @@ ActsExamples::RootMeasurementWriter::RootMeasurementWriter(
std::move(dTrees));
}

ActsExamples::RootMeasurementWriter::~RootMeasurementWriter() = default;
ActsExamples::RootMeasurementWriter::~RootMeasurementWriter() {
if (m_outputFile != nullptr) {
m_outputFile->Close();
}
}

ActsExamples::ProcessCode ActsExamples::RootMeasurementWriter::endRun() {
/// Close the file if it's yours
Expand Down
6 changes: 5 additions & 1 deletion Examples/Io/Root/src/RootParticleWriter.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -65,7 +65,11 @@ ActsExamples::RootParticleWriter::RootParticleWriter(
m_outputTree->Branch("sub_particle", &m_subParticle);
}

ActsExamples::RootParticleWriter::~RootParticleWriter() = default;
ActsExamples::RootParticleWriter::~RootParticleWriter() {
if (m_outputFile != nullptr) {
m_outputFile->Close();
}
}

ActsExamples::ProcessCode ActsExamples::RootParticleWriter::endRun() {
if (m_outputFile != nullptr) {
Expand Down
6 changes: 5 additions & 1 deletion Examples/Io/Root/src/RootPlanarClusterWriter.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -78,7 +78,11 @@ ActsExamples::RootPlanarClusterWriter::RootPlanarClusterWriter(
m_outputTree->Branch("truth_barcode", &m_t_barcode);
}

ActsExamples::RootPlanarClusterWriter::~RootPlanarClusterWriter() = default;
ActsExamples::RootPlanarClusterWriter::~RootPlanarClusterWriter() {
if (m_outputFile != nullptr) {
m_outputFile->Close();
}
}

ActsExamples::ProcessCode ActsExamples::RootPlanarClusterWriter::endRun() {
// Write the tree
Expand Down
7 changes: 5 additions & 2 deletions Examples/Io/Root/src/RootPropagationStepsWriter.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -70,8 +70,11 @@ ActsExamples::RootPropagationStepsWriter::RootPropagationStepsWriter(
m_outputTree->Branch("nStepTrials", &m_nStepTrials);
}

ActsExamples::RootPropagationStepsWriter::~RootPropagationStepsWriter() =
default;
ActsExamples::RootPropagationStepsWriter::~RootPropagationStepsWriter() {
if (m_outputFile != nullptr) {
m_outputFile->Close();
}
}

ActsExamples::ProcessCode ActsExamples::RootPropagationStepsWriter::endRun() {
// Write the tree
Expand Down
6 changes: 5 additions & 1 deletion Examples/Io/Root/src/RootSimHitWriter.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -63,7 +63,11 @@ ActsExamples::RootSimHitWriter::RootSimHitWriter(
m_outputTree->Branch("sensitive_id", &m_sensitiveId);
}

ActsExamples::RootSimHitWriter::~RootSimHitWriter() = default;
ActsExamples::RootSimHitWriter::~RootSimHitWriter() {
if (m_outputFile != nullptr) {
m_outputFile->Close();
}
}

ActsExamples::ProcessCode ActsExamples::RootSimHitWriter::endRun() {
if (m_outputFile != nullptr) {
Expand Down
6 changes: 5 additions & 1 deletion Examples/Io/Root/src/RootTrackParameterWriter.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -97,7 +97,11 @@ ActsExamples::RootTrackParameterWriter::RootTrackParameterWriter(
}
}

ActsExamples::RootTrackParameterWriter::~RootTrackParameterWriter() = default;
ActsExamples::RootTrackParameterWriter::~RootTrackParameterWriter() {
if (m_outputFile != nullptr) {
m_outputFile->Close();
}
}

ActsExamples::ProcessCode ActsExamples::RootTrackParameterWriter::endRun() {
if (m_outputFile != nullptr) {
Expand Down
7 changes: 5 additions & 2 deletions Examples/Io/Root/src/RootVertexPerformanceWriter.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -83,8 +83,11 @@ ActsExamples::RootVertexPerformanceWriter::RootVertexPerformanceWriter(
}
}

ActsExamples::RootVertexPerformanceWriter::~RootVertexPerformanceWriter() =
default;
ActsExamples::RootVertexPerformanceWriter::~RootVertexPerformanceWriter() {
if (m_outputFile != nullptr) {
m_outputFile->Close();
}
}

ActsExamples::ProcessCode ActsExamples::RootVertexPerformanceWriter::endRun() {
if (m_outputFile != nullptr) {
Expand Down