Commit 7e5aae1
committed
fix: add ScopeGuard to wait async tasks before early return in Clean()
When GetUsedFiles() returns an error (e.g. index manifest not supported),
Clean() would return immediately while thread pool tasks submitted via
Via(executor_.get(), ...) were still running. These tasks capture 'this'
and access members like fs_, causing use-after-free when the
OrphanFilesCleanerImpl is destroyed shortly after.
Add a ScopeGuard that calls CollectAll(file_statuses_futures) to ensure
all submitted async tasks complete before the function returns, preventing
the intermittent segmentation fault.1 parent 2d5fdbf commit 7e5aae1
2 files changed
Lines changed: 7 additions & 1 deletion
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
45 | 45 | | |
46 | 46 | | |
47 | 47 | | |
| 48 | + | |
| 49 | + | |
| 50 | + | |
48 | 51 | | |
49 | 52 | | |
50 | 53 | | |
| |||
96 | 99 | | |
97 | 100 | | |
98 | 101 | | |
99 | | - | |
| 102 | + | |
100 | 103 | | |
101 | 104 | | |
102 | 105 | | |
| |||
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
97 | 97 | | |
98 | 98 | | |
99 | 99 | | |
| 100 | + | |
| 101 | + | |
100 | 102 | | |
101 | 103 | | |
102 | 104 | | |
103 | 105 | | |
104 | 106 | | |
| 107 | + | |
105 | 108 | | |
106 | 109 | | |
107 | 110 | | |
| |||
0 commit comments