diff options
author | Domen Vrankar <domen.vrankar@gmail.com> | 2016-12-25 09:51:34 (GMT) |
---|---|---|
committer | Domen Vrankar <domen.vrankar@gmail.com> | 2016-12-25 09:51:34 (GMT) |
commit | 36bc7e4c3f91c560df8051afedddea3f49474264 (patch) | |
tree | bd3c16699d1739da20218634cf2db49e05394408 /Source/cmLocale.h | |
parent | 05c14ea0a97f3e8a7287f3e0bbc57f91e2a6e490 (diff) | |
download | CMake-36bc7e4c3f91c560df8051afedddea3f49474264.zip CMake-36bc7e4c3f91c560df8051afedddea3f49474264.tar.gz CMake-36bc7e4c3f91c560df8051afedddea3f49474264.tar.bz2 |
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.
Diffstat (limited to 'Source/cmLocale.h')
-rw-r--r-- | Source/cmLocale.h | 5 |
1 files changed, 3 insertions, 2 deletions
diff --git a/Source/cmLocale.h b/Source/cmLocale.h index e8e751d..cca7cf5 100644 --- a/Source/cmLocale.h +++ b/Source/cmLocale.h @@ -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 |