Commit 697a0b0
committed
[core] Ensure registration of atexit function is done only once
Before this commit, the following triggered two calls to
TROOT::EndOfProcessCleanups:
python -c "import ROOT; ROOT.TH1F"
This happened because the TApplication constructor registered a
function that calls EndOfProcessCleanups with the C `atexit` and
PyROOT registered another similar function with the Python atexit
module in `__init__.py`. The Python atexit happened before the C
atexit.
This commit introduces a static function in TApplication that
registers the call to EndOfProcessCleanups with the C `atexit` and
this is guaranteed to be run only once through the use of
std::call_once. This new function can be called both from PyROOT
and the TApplication constructor, to make sure it will be
registered by either of them.
Furthermore, calling this from PyROOT means that now
EndOfProcessCleanups is always called at the very end of the
program, seemingly a more sensible choice.1 parent f8b8277 commit 697a0b0
File tree
3 files changed
+16
-7
lines changed- bindings/pyroot/pythonizations/python/ROOT
- core/base
- inc
- src
3 files changed
+16
-7
lines changed| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
79 | 79 | | |
80 | 80 | | |
81 | 81 | | |
82 | | - | |
| 82 | + | |
| 83 | + | |
83 | 84 | | |
84 | 85 | | |
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
158 | 158 | | |
159 | 159 | | |
160 | 160 | | |
| 161 | + | |
161 | 162 | | |
162 | 163 | | |
163 | 164 | | |
| |||
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
49 | 49 | | |
50 | 50 | | |
51 | 51 | | |
| 52 | + | |
52 | 53 | | |
53 | 54 | | |
54 | 55 | | |
55 | 56 | | |
56 | 57 | | |
| 58 | + | |
57 | 59 | | |
58 | 60 | | |
59 | 61 | | |
| |||
91 | 93 | | |
92 | 94 | | |
93 | 95 | | |
| 96 | + | |
| 97 | + | |
| 98 | + | |
| 99 | + | |
| 100 | + | |
| 101 | + | |
| 102 | + | |
| 103 | + | |
| 104 | + | |
94 | 105 | | |
95 | 106 | | |
96 | 107 | | |
| |||
156 | 167 | | |
157 | 168 | | |
158 | 169 | | |
159 | | - | |
160 | | - | |
161 | | - | |
162 | | - | |
163 | | - | |
164 | | - | |
| 170 | + | |
| 171 | + | |
165 | 172 | | |
166 | 173 | | |
167 | 174 | | |
| |||
0 commit comments