diff options
| author | 2023-07-05 13:29:51 +0100 | |
|---|---|---|
| committer | 2023-07-05 13:29:51 +0100 | |
| commit | 1cf51aae80055e5fb9b60a1bcd8a55f65d062ca2 (patch) | |
| tree | 1a0f5f7e8024729af4593c00ea46bae3b6f115bd /src | |
| parent | Expand the file path in DoOpenFile not DoInclude. (diff) | |
Avoid iterator invalidation issues in ActionList::Run.
Diffstat (limited to 'src')
| -rw-r--r-- | src/cull.cpp | 6 |
1 files changed, 4 insertions, 2 deletions
diff --git a/src/cull.cpp b/src/cull.cpp index 4957773e2..b2cf536a5 100644 --- a/src/cull.cpp +++ b/src/cull.cpp @@ -127,7 +127,9 @@ void CullList::Apply() void ActionList::Run() { - for (auto* action : list) - action->Call(); + // IMPORTANT: we can't use a range-based for loop here as adding to the list + // may invalidate the list iterators. + for (size_t idx = 0; idx < list.size(); ++idx) + list[idx]->Call(); list.clear(); } |
