From: Corinna Vinschen <corinna-cygwin@cygwin.com>
To: cygwin@cygwin.com
Subject: Re: All wx apps crash because of nl_langinfo(CODESET) returns garbage
Date: Wed, 01 Mar 2017 09:19:00 -0000 [thread overview]
Message-ID: <20170301091913.GC13542@calimero.vinschen.de> (raw)
In-Reply-To: <CAKoP8LSc4L5MXUD-MJH6SXz2Ldk2iyzcekUjvExzc6UY0pCHvw@mail.gmail.com>
[-- Attachment #1: Type: text/plain, Size: 1009 bytes --]
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-3.0.2.0-2/src/common/intl.cpp:811:
> 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
--
Corinna Vinschen Please, send mails regarding Cygwin to
Cygwin Maintainer cygwin AT cygwin DOT com
Red Hat
[-- Attachment #2: signature.asc --]
[-- Type: application/pgp-signature, Size: 819 bytes --]
prev parent reply other threads:[~2017-03-01 9:19 UTC|newest]
Thread overview: 2+ messages / expand[flat|nested] mbox.gz Atom feed top
2017-03-01 5:56 Kolya Kosenko
2017-03-01 9:19 ` Corinna Vinschen [this message]
Reply instructions:
You may reply publicly to this message via plain-text email
using any one of the following methods:
* Save the following mbox file, import it into your mail client,
and reply-to-all from there: mbox
Avoid top-posting and favor interleaved quoting:
https://en.wikipedia.org/wiki/Posting_style#Interleaved_style
* Reply using the --to, --cc, and --in-reply-to
switches of git-send-email(1):
git send-email \
--in-reply-to=20170301091913.GC13542@calimero.vinschen.de \
--to=corinna-cygwin@cygwin.com \
--cc=cygwin@cygwin.com \
/path/to/YOUR_REPLY
https://kernel.org/pub/software/scm/git/docs/git-send-email.html
* If your mail client supports setting the In-Reply-To header
via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line
before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for read-only IMAP folder(s) and NNTP newsgroup(s).