Commit 5bd7525
authored
chore: use Box::leak() to ensure logging guard lives for the program's lifetime (#17425)
chore: use `Box::leak()` to ensure logging guard lives for the program's lifetime
Previously, the logging guard was held with `let _guard = ...`, which
caused it to be dropped when the `main` function returned. This could
lead to an error when other threads, still running and depending on the
logging guard for log output, attempt to log after the guard has been
dropped.
By using `Box::leak()`, the logging guard is ensured to remain valid for
the entire lifetime of the program, preventing such errors.
- Fix: #166761 parent 34be4e4 commit 5bd7525
File tree
4 files changed
+8
-4
lines changed- src/meta
- binaries
- metactl
- metaverifier
- meta
- process/src
4 files changed
+8
-4
lines changed| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
71 | 71 | | |
72 | 72 | | |
73 | 73 | | |
74 | | - | |
| 74 | + | |
| 75 | + | |
75 | 76 | | |
76 | 77 | | |
77 | 78 | | |
| |||
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
375 | 375 | | |
376 | 376 | | |
377 | 377 | | |
378 | | - | |
| 378 | + | |
| 379 | + | |
379 | 380 | | |
380 | 381 | | |
381 | 382 | | |
| |||
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
94 | 94 | | |
95 | 95 | | |
96 | 96 | | |
97 | | - | |
| 97 | + | |
| 98 | + | |
98 | 99 | | |
99 | 100 | | |
100 | 101 | | |
| |||
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
61 | 61 | | |
62 | 62 | | |
63 | 63 | | |
64 | | - | |
| 64 | + | |
65 | 65 | | |
66 | 66 | | |
67 | 67 | | |
68 | 68 | | |
| 69 | + | |
69 | 70 | | |
70 | 71 | | |
71 | 72 | | |
| |||
0 commit comments