From efc609577ffbbc65464e1c739ab63d26abc54a5d Mon Sep 17 00:00:00 2001 From: James Turner Date: Fri, 5 Oct 2018 10:40:35 +0100 Subject: [PATCH] Packages: check for existing update when scheduling This is fixing an issue identified in the launcher in a secondary way, to ensure if another user of the API tries to schedule an already scheduled package, we ignore the second request. --- simgear/package/Root.cxx | 6 ++++++ 1 file changed, 6 insertions(+) diff --git a/simgear/package/Root.cxx b/simgear/package/Root.cxx index d7e06b4f..b207af2c 100644 --- a/simgear/package/Root.cxx +++ b/simgear/package/Root.cxx @@ -594,6 +594,12 @@ void Root::scheduleToUpdate(InstallRef aInstall) if (!aInstall) { throw sg_exception("missing argument to scheduleToUpdate"); } + + auto it = std::find(d->updateDeque.begin(), d->updateDeque.end(), aInstall); + if (it != d->updateDeque.end()) { + // already scheduled to update + return; + } PackageList deps = aInstall->package()->dependencies(); for (Package* dep : deps) {