Commit 9f04cd3
committed
trace2: fix incomplete disposal of writers on cleanup
ReleaseManagedResources iterates forward by index while removing
elements from the same list. Each removal shifts remaining elements
left, but the loop increments i, causing the next element to be
skipped. As a result, only about half of the writers are disposed and
removed, leaving file handles or buffers open.
Fix by iterating in reverse so that removals do not shift any unvisited
indices, and use RemoveAt(i) to avoid a redundant linear search.
Signed-off-by: Matthew John Cheetham <mjcheetham@outlook.com>1 parent e78f0db commit 9f04cd3
File tree
1 file changed
+3
-3
lines changed1 file changed
+3
-3
lines changed| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
460 | 460 | | |
461 | 461 | | |
462 | 462 | | |
463 | | - | |
| 463 | + | |
464 | 464 | | |
465 | | - | |
| 465 | + | |
466 | 466 | | |
467 | | - | |
| 467 | + | |
468 | 468 | | |
469 | 469 | | |
470 | 470 | | |
| |||
0 commit comments