[PATCH] Gettext initialization deadlock on Win32
@jlindgren90
Submitted by John Lindgren Link to original bug (#726948)
Description
On Win32, gettext initialization can deadlock due to ensure_gettext_initialized() being called recursively. The deadlock was noticed while testing Unicode support for a GTK+ application. To reproduce, install GLib and GTK+ in a prefix containing Cyrillic characters on an English language edition of Windows. Then run any program that call gtk_init() -- gtk3-demo.exe will do. The call trace is as follows (sorry it is not an actual GDB trace; GDB has trouble with the Cyrillic):
ensure_gettext_initialized
glib_gettext
g_convert_with_iconv
g_convert
g_locale_from_utf8
g_win32_locale_filename_from_utf8
_glib_get_locale_dir
ensure_gettext_initialized
glib_gettext
g_convert_with_iconv
g_convert
g_locale_from_utf8
g_win32_locale_filename_from_utf8
_gtk_get_localedir
gettext_initialization
gtk_parse_args
gtk_init_check
gtk_init
Essentially the problem is that some of the functions called to initialize gettext support, will call back into gettext to print localized error messages. I suppose that a fix would involve allowing the gettext initialization to detect being called recursively and short circuit (i.e. return untranslated English) in that case. I don't have a patch yet but will work on one.
Version: 2.38.x