mirror of
https://github.com/Kitware/CMake.git
synced 2026-01-07 14:20:06 -06:00
store old locale to a temporary variable
On Windows XP 32 bit setLocale seems to cause old pointer invalidation and causes program crash in destructor. This was causing CPackZIP to crash so to fix it we copy the value into a temporary variable.
This commit is contained in:
@@ -6,10 +6,11 @@
|
||||
#include <cmConfigure.h>
|
||||
|
||||
#include <locale.h>
|
||||
#include <string>
|
||||
|
||||
class cmLocaleRAII
|
||||
{
|
||||
const char* OldLocale;
|
||||
std::string OldLocale;
|
||||
|
||||
public:
|
||||
cmLocaleRAII()
|
||||
@@ -17,7 +18,7 @@ public:
|
||||
{
|
||||
setlocale(LC_CTYPE, "");
|
||||
}
|
||||
~cmLocaleRAII() { setlocale(LC_CTYPE, this->OldLocale); }
|
||||
~cmLocaleRAII() { setlocale(LC_CTYPE, this->OldLocale.c_str()); }
|
||||
};
|
||||
|
||||
#endif
|
||||
|
||||
Reference in New Issue
Block a user