Fix restoring locale in SetArguments()
The string returned by setlocale() can be overwritten by subsequent calls, so make a copy of it. See #18203
This commit is contained in:
@@ -429,9 +429,9 @@ void wxCmdLineParserData::SetArguments(int argc, char **argv)
|
|||||||
// temporarily change the locale here. The only drawback is that changing
|
// temporarily change the locale here. The only drawback is that changing
|
||||||
// the locale is thread-unsafe but precisely because we're called so early
|
// the locale is thread-unsafe but precisely because we're called so early
|
||||||
// it's hopefully safe to assume that no other threads had been created yet.
|
// it's hopefully safe to assume that no other threads had been created yet.
|
||||||
char * const locOld = SetAllLocaleFacets(NULL);
|
const wxCharBuffer locOld(SetAllLocaleFacets(NULL));
|
||||||
SetAllLocaleFacets("");
|
SetAllLocaleFacets("");
|
||||||
wxON_BLOCK_EXIT1( SetAllLocaleFacets, locOld );
|
wxON_BLOCK_EXIT1( SetAllLocaleFacets, locOld.data() );
|
||||||
|
|
||||||
for ( int n = 0; n < argc; n++ )
|
for ( int n = 0; n < argc; n++ )
|
||||||
{
|
{
|
||||||
|
Reference in New Issue
Block a user