Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(209)

Unified Diff: src/gpu/GrAutoLocaleSetter.h

Issue 1514083002: Fix intermittent GrAutoLocaleSetter crashes on Windows (Closed) Base URL: https://skia.googlesource.com/skia.git@master
Patch Set: Created 5 years ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View side-by-side diff with in-line comments
Download patch
« no previous file with comments | « no previous file | no next file » | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: src/gpu/GrAutoLocaleSetter.h
diff --git a/src/gpu/GrAutoLocaleSetter.h b/src/gpu/GrAutoLocaleSetter.h
index 51164e9813a056016a4a71a26855cc315a4ad6e4..ca232d218add82cd16f6c80c15cb8d31bb92c261 100644
--- a/src/gpu/GrAutoLocaleSetter.h
+++ b/src/gpu/GrAutoLocaleSetter.h
@@ -10,6 +10,10 @@
#include "GrTypes.h"
+#if defined(SK_BUILD_FOR_WIN)
+#include "SkString.h"
+#endif
+
#if !defined(SK_BUILD_FOR_ANDROID)
#include <locale.h>
#endif
@@ -42,8 +46,8 @@ public:
~GrAutoLocaleSetter () {
#if defined(SK_BUILD_FOR_WIN)
- if (fOldLocale) {
- setlocale(LC_ALL, fOldLocale);
+ if (!fOldLocale.isEmpty()) {
bsalomon 2015/12/10 15:12:23 IIUC empty string is valid. "If locale points to a
Kimmo Kinnunen 2015/12/11 07:50:17 Done.
+ setlocale(LC_ALL, fOldLocale.c_str());
}
_configthreadlocale(fOldPerThreadLocale);
#elif !defined(SK_BUILD_FOR_ANDROID) && !defined(__UCLIBC__)
@@ -57,7 +61,7 @@ public:
private:
#if defined(SK_BUILD_FOR_WIN)
int fOldPerThreadLocale;
- const char* fOldLocale;
+ SkString fOldLocale;
#elif !defined(SK_BUILD_FOR_ANDROID) && !defined(__UCLIBC__)
locale_t fOldLocale;
locale_t fLocale;
« no previous file with comments | « no previous file | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698