a11y: Change HC icon theme first
There are two ways for applications to provide a high contrast icon:
- install an icon into the HighContrast theme
- install a symbolic icon into the default hicolor theme
The latter is preferred nowadays, and implemented in the high-contrast CSS variant by enforcing the symbolic icon style.
However together with the way we currently enable/disable high-contrast, this can lead to the following race:
- the GTK theme is changed from HighContrast
- we reload the default stylesheet
- the icon style changes to "regular", so we request a new icon from the HighContrast icon theme
- the icon theme is changed from HighContrast
- we evict existing icons from the cache
- we reload icons for the new icon theme; however as we find a pending request (from 3), we re-use it
- the request from 3 finishes, and we end up with a wrong icon in the cache
The simplest fix is to change the icon theme before the GTK theme: Unlike the theme name, the icon style is encoded in the cache key, so we won't re-use an old (and incorrect) request in that case.
Related: #2414 (closed)