Treat metapackage depends as not auto installed #3008
Merged
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
Problem
If you install a
depends
-based modpack, its mods will be queued for removal automatically:This may also cause a crash:
Cause
After #2753, we track which mods are auto-installed to satisfy dependencies, so they can be uninstalled when the depending modules are uninstalled.
A modpack is represented as a
CkanModule
in whichIsMetapackage
istrue
, and it is not saved to the registry when it is installed. So its dependencies are all flagged as auto-installed, but their depending module is missing, and they are queued for removal.The crash indicates that the GUI runtime is asking us to draw an item that doesn't exist. Maybe this is caused by a weird timing issue, because having auto-removable modules brings the change set back at the end of installation?
Changes
Now we can ask the relationship resolver whether a module is auto-installed. To make this determination, in addition to checking whether it's being installed to satisfy a dependency (the previous logic) it also checks whether the depending module is a metapackage; if so, then the dependency is considered as not auto-installed. This will force modpack dependencies to be considered not auto-installed.
As well, the
ThemedTabControl
now protects itself from runtime malfeasance by ignoringArgumentOutOfRangeException
. This should prevent issues like this from causing crashes in the future.Fixes #3007.