Fix compatible popup messing with max game version column #3976
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 open the compatible game versions dialog and click accept (whether or not you make any changes), the values in the max game version column change in strange and hard to understand ways.
Cause
As of #3904, the max game versions column's behavior depends on the ordering of the global list of known game versions (e.g., in
KerbalSpaceProgram.KnownVersions
for KSP1), which it uses to find the latest real game version with which a mod is compatible. It's loaded in ascending order and is supposed to stay that way.The compatible versions popup currently changes the sorting of this global list when it loads! So the next time you refresh the mod list, the versions are in descending order, so wrong versions are pulled out by the max game verison column.
Changes
KerbalSpaceProgram.KnownVersions
can be initialized several times due to parallel loading. Now it uses a lock to load only once.Fixes #3973.