From 08906ebbb04b77dc2aec55c8688c36fa577f100c Mon Sep 17 00:00:00 2001 From: James Turner Date: Fri, 1 Jan 2021 15:34:08 +0000 Subject: [PATCH] Launhcer: fix crashes adding a catalog Traversing a container which is modified causes crashes, take a copy during traversal for firePackageStatus. Sentry-Id: FLIGHTGEAR-CJF Sentry-Id: FLIGHTGEAR-CJ5 --- simgear/package/Root.cxx | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-) diff --git a/simgear/package/Root.cxx b/simgear/package/Root.cxx index 49925cbe..983729fb 100755 --- a/simgear/package/Root.cxx +++ b/simgear/package/Root.cxx @@ -133,7 +133,9 @@ public: void fireRefreshStatus(CatalogRef catalog, Delegate::StatusCode status) { - for (auto d : delegates) { + // take a copy of delegates since firing this can modify the data + const auto currentDelegates = delegates; + for (auto d : currentDelegates) { d->catalogRefreshed(catalog, status); } }