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 mod with recommendations, suggestions, or a
provides
dependency in GUI on Linux with a recent-ish version of Mono, you get a big red X when you accept the recommendations orprovides
selection prompt:This was observed on Mono 5.14.0.177, but it works fine on Mono 5.10.1.20. Intermediate versions have not yet been tested.
Cause
As of some recent version of Mono, it's apparently no longer safe to hide the active tab of a
TabControl
. The control keeps the active tab index as it was, pointing to the removed tab, and then when the runtime attempts to draw the control, it tries to use that index to get the active tab, which doesn't work because it's gone:(However, the actual code for
TabControl
hasn't changed in many years. Maybe it's a new race condition due to threading changes in the draw logic? Who knows.)This happens in two places currently:
CKAN/GUI/MainInstall.cs
Line 133 in 37c8477
CKAN/GUI/MainDialogs.cs
Line 69 in 37c8477
It can also be made to happen in a third place if we move a
HideTab
call before aShowTab
call:CKAN/GUI/MainChangeset.cs
Lines 108 to 109 in 37c8477
Changes
Luckily we already have a
TabController
wrapper, so we can work around this cleanly.Now
TabController.HideTab
callsDeselectTab
if the tab it's hiding is selected (which Mono should be doing itself anyway). This makes it safe to hide tabs again.Fixes #2499.