mirror of
https://github.com/reactos/CMake.git
synced 2024-12-13 22:58:41 +00: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:
parent
05c14ea0a9
commit
36bc7e4c3f
@ -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
|
||||
|
Loading…
Reference in New Issue
Block a user