From 9557b7e850bb2898df577d1c2db47aab797e4430 Mon Sep 17 00:00:00 2001 From: Alex Zolotarev Date: Tue, 15 Dec 2015 16:17:00 +0300 Subject: [PATCH] Workaround for crash when parsing doubles, if decimal delimiter is comma instead of dot. TODO: Use locale-independent double parser. --- qt/main.cpp | 7 +++++++ 1 file changed, 7 insertions(+) diff --git a/qt/main.cpp b/qt/main.cpp index acfb89f402..a17eacf594 100644 --- a/qt/main.cpp +++ b/qt/main.cpp @@ -12,6 +12,7 @@ #include "base/object_tracker.hpp" #include "std/cstdio.hpp" +#include "std/cstdlib.hpp" #include "3party/Alohalytics/src/alohalytics.h" @@ -62,6 +63,12 @@ namespace int main(int argc, char * argv[]) { + // Our double parsing code (base/string_utils.hpp) needs dots as a floating point delimiters, not commas. + // TODO: Refactor our doubles parsing code to use locale-independent delimiters. + // For example, https://github.com/google/double-conversion can be used. + // See http://dbaron.org/log/20121222-locale for more details. + (void)::setenv("LC_NUMERIC", "C", 1); + InitializeFinalize mainGuard; UNUSED_VALUE(mainGuard);