Locale locking fixes
This is a slightly re-worked set of fixes that was originally authored by Jacek Caban jacek@codeweavers.com in 2017.
- Add locking around character set conversion contexts.
- Remove some static variables in Xlcmbtowc and _Xlcwctomb
- Admit that we can never unload locale context data
The last is the only one I expect to evoke a bit of concern -- we're committing to never releasing memory used by X locale data. The reason for this is pretty simple -- _XlcCurrentLC
returns a pointer to locale data which has no bound on lifetime as there's no matching free function. Because of this, I removed all of the reference counting and turned _XCloseLC
into a no-op. This latter bit replaces the patch that Jacek wrote which added locking to this function.