addon/mg: Force version_info cache refresh after installing add-ons

The cache obviously becomes goes stale after installing/upgrading any
amount of add-ons. It's normally refreshed in the same steps as all
other caches (WML, graphics, etc.), but when we are in the manager UI
loop that code doesn't get a chance to run, so we must reset this
particular cache before continuing. This makes add-on statuses work
correctly.

In general, the version info cache was a terrible idea, but perhaps its
underpinnings could be adapted for add-on dependency/conflict resolution
in the future.
This commit is contained in:
Ignacio R. Morelle 2012-03-20 22:24:37 +00:00
parent 302be06fc5
commit 63c5ca5217

View file

@ -721,6 +721,16 @@ bool addons_manager_ui(display& disp, const std::string& remote_address)
try {
do {
if(need_wml_cache_refresh) {
// The version info cache has gone stale because we installed/upgraded
// an add-on in the previous iteration. Normally this cache is refreshed
// along with all other caches, but we don't want to do all that here.
// Thus, we refresh this specific cache when required, so that add-ons
// are properly reported as installed/upgraded before leaving the
// manager UI.
refresh_addon_version_info_cache();
}
// TODO: don't create a new client instance each time we return to the UI,
// but for that we need to make sure any pending network operations are canceled
// whenever addons_client throws user_exit even before it gets destroyed