From 484d9591e558f48512a334387cb2457c5af77976 Mon Sep 17 00:00:00 2001 From: Iris Morelle Date: Sat, 14 Mar 2020 01:15:48 -0300 Subject: [PATCH] gui2/addon_manager: Re-read add-on versions after each update batch The Update All codepath is unique in that it doesn't trigger a re-read of add-on versions until the very end, once the full run has completed. The problem with this is that install_addon_with_checks() may update dependencies of individual add-ons in the process, resulting in redundant downloads of any affected add-ons if the player isn't paying attention. Address this by triggering a re-read of add-on versions after every single update batch that results in a download. Closes #3273. --- changelog.md | 3 +++ src/gui/dialogs/addon/manager.cpp | 7 +++++++ 2 files changed, 10 insertions(+) diff --git a/changelog.md b/changelog.md index de387dbb5b21..667fdfdd6788 100644 --- a/changelog.md +++ b/changelog.md @@ -1,4 +1,7 @@ ## Version 1.14.11+dev + ### Add-ons client + * Ensure the client doesn't re-download dependencies that have just been updated during an Update All + run by re-reading add-on versions after each update batch (issue #3273). ### Language and i18n * Updated translations: Czech, Dutch, Esperanto, Finnish, French, Portuguese, Portuguese (Brazil), Swedish. diff --git a/src/gui/dialogs/addon/manager.cpp b/src/gui/dialogs/addon/manager.cpp index aaafea5a5b85..dd62077a25ed 100644 --- a/src/gui/dialogs/addon/manager.cpp +++ b/src/gui/dialogs/addon/manager.cpp @@ -705,6 +705,13 @@ void addon_manager::update_all_addons(window& window) if(tracking_info_[a.first].state == ADDON_INSTALLED_UPGRADABLE) { addons_client::install_result result = client_.install_addon_with_checks(addons_, a.second); + if(result.wml_changed) { + // Updating an add-on may have resulted in its dependencies being updated + // as well, so we need to reread version info blocks afterwards to make sure + // we don't try to re-download newly updated add-ons. + refresh_addon_version_info_cache(); + } + // Take note if any wml_changes occurred need_wml_cache_refresh_ |= result.wml_changed; }