This is the mail archive of the cygwin mailing list for the Cygwin project.

Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]
Other format: [Raw text]

Re: All wx apps crash because of nl_langinfo(CODESET) returns garbage

On Mar  1 07:56, Kolya Kosenko wrote:
> All wxWidgets-based application crash because call
> nl_langinfo(CODESET) returns sometimes garbage during wxWidgets
> initialization at
> /usr/src/debug/wxWidgets3.0-
>     char *oldLocale = strdup(setlocale(LC_CTYPE, NULL));
>     setlocale(LC_CTYPE, "");
>     const char *alang = nl_langinfo(CODESET);
>     setlocale(LC_CTYPE, oldLocale);
>     free(oldLocale);
> alang variable is not null and garbage here! It causes wxWidgets
> assertion failure at wxString::FromAscii().

At first sight this looks like a bug to me.  The information returned by
nl_langinfo is only guaranteed to be stable if you don't call setlocale
or nl_langinfo again.  If you need the result of nl_langinfo(CODESET)
even after calling setlocale again, you have to strdup it.


Corinna Vinschen                  Please, send mails regarding Cygwin to
Cygwin Maintainer                 cygwin AT cygwin DOT com
Red Hat

Attachment: signature.asc
Description: PGP signature

Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]