File tree Expand file tree Collapse file tree 4 files changed +31
-0
lines changed
Expand file tree Collapse file tree 4 files changed +31
-0
lines changed Original file line number Diff line number Diff line change @@ -111,4 +111,9 @@ ROOTTEST_ADD_TEST(tclassStl
111111 OUTREF tclassStl.ref
112112 RUN_SERIAL )
113113
114+ ROOTTEST_ADD_TEST(TClassAtTearDown
115+ MACRO execTClassAtTearDown.C
116+ COPY_TO_BUILDDIR empty.root
117+ OUTREF execTClassAtTearDown.ref)
118+
114119ROOTTEST_ADD_TESTDIRS()
Original file line number Diff line number Diff line change 1+ #include "TFile.h"
2+
3+ void execTClassAtTearDown ()
4+ {
5+ TFile f ("empty.root" , "READ" );
6+
7+ // Because of this call to exit, even-though the TFile is
8+ // on the stack, it will not be destructed.
9+ // Furthermore, TROOT::CloseFile will not destructed either
10+ // since it is on the stack.
11+ // Subsequently the TFile object will still be on the list of
12+ // files when it is being deleted and thus will need to
13+ // interogate the object *AND* its TClass.
14+ // We setup this exmaple so that at the time `exit` is called
15+ // the `TClass` for `TFile` has not been created yet.
16+ // Consequently, its creation will be asked for during
17+ // the deletion of the list of files ... which is in the
18+ // middle of the tear down ... if a TClass object is created
19+ // at that time, it will use some resources (static tables)
20+ // that have already been tear down, resulting in crashes.
21+ // The new behavior is to sort-of ignore this late request
22+ // and build only a dummy TClass object (which does not
23+ // do any registrations).
24+ exit (0 );
25+ }
Original file line number Diff line number Diff line change 1+
You can’t perform that action at this time.
0 commit comments