Skip to content

Commit

Permalink
Delete the object held by gROOT after we reset the globals.
Browse files Browse the repository at this point in the history
For example this allows unique_ptr to be deleted first and thus inform TROOT if need be.

Fix #13462
  • Loading branch information
pcanal committed Aug 16, 2023
1 parent d1212cc commit 329d6a4
Showing 1 changed file with 7 additions and 2 deletions.
9 changes: 7 additions & 2 deletions core/base/src/TROOT.cxx
Original file line number Diff line number Diff line change
Expand Up @@ -1117,11 +1117,13 @@ namespace {

void TROOT::CloseFiles()
{
// Close files without deleting the objects (`ResetGlobals` will be called
// next; see `EndOfProcessCleanups()` below.)
if (fFiles && fFiles->First()) {
R__ListSlowClose(static_cast<TList*>(fFiles));
}
// and Close TROOT itself.
Close("slow");
Close("nodelete");
// Now sockets.
if (fSockets && fSockets->First()) {
if (0==fCleanups->FindObject(fSockets) ) {
Expand Down Expand Up @@ -1200,14 +1202,17 @@ void TROOT::EndOfProcessCleanups()
CloseFiles();

if (gInterpreter) {
// This might delete some of the objects 'held' by the TFiles (hence
// `CloseFiles` must not delete them)
gInterpreter->ResetGlobals();
}

// Now delete the objects 'held' by the TFiles so that it
// Now delete the objects still 'held' by the TFiles so that it
// is done before the tear down of the libraries.
if (fClosedObjects && fClosedObjects->First()) {
R__ListSlowDeleteContent(static_cast<TList*>(fClosedObjects));
}
fList->Delete("slow");

// Now a set of simpler things to delete. See the same ordering in
// TROOT::~TROOT
Expand Down

0 comments on commit 329d6a4

Please sign in to comment.