From 18162f73f330e63067017ba85175a2f2f9c3f7f7 Mon Sep 17 00:00:00 2001
From: Philippe Canal <pcanal@fnal.gov>
Date: Fri, 1 Nov 2013 05:07:50 -0500
Subject: [PATCH] Close the file before starting to free TFile's resources

---
 io/io/src/TFile.cxx | 6 +++---
 1 file changed, 3 insertions(+), 3 deletions(-)

diff --git a/io/io/src/TFile.cxx b/io/io/src/TFile.cxx
index 0b8698671b8..4c91e88ae17 100644
--- a/io/io/src/TFile.cxx
+++ b/io/io/src/TFile.cxx
@@ -876,9 +876,6 @@ void TFile::Close(Option_t *option)
       WriteStreamerInfo();
    }
 
-   delete fClassIndex;
-   fClassIndex = 0;
-
    // Finish any concurrent I/O operations before we close the file handles.
    if (fCacheRead) fCacheRead->Close();
    {
@@ -908,6 +905,9 @@ void TFile::Close(Option_t *option)
    if (gMonitoringWriter)
       gMonitoringWriter->SendFileCloseEvent(this);
 
+   delete fClassIndex;
+   fClassIndex = 0;
+
    // Delete free segments from free list (but don't delete list header)
    if (fFree) {
       fFree->Delete();
-- 
GitLab