mirror of
https://github.com/SoftFever/OrcaSlicer.git
synced 2025-10-27 10:41:15 -06:00
Fixed a memory leak during locales switching on macOS and
removed frequent locales switching during gcode processing
This commit is contained in:
parent
d8ac2ceaf6
commit
d2874f2e34
4 changed files with 11 additions and 10 deletions
|
|
@ -11,11 +11,14 @@ CNumericLocalesSetter::CNumericLocalesSetter()
|
|||
_configthreadlocale(_ENABLE_PER_THREAD_LOCALE);
|
||||
m_orig_numeric_locale = std::setlocale(LC_NUMERIC, nullptr);
|
||||
std::setlocale(LC_NUMERIC, "C");
|
||||
#else
|
||||
#elif __linux__
|
||||
m_original_locale = uselocale((locale_t)0);
|
||||
m_new_locale = duplocale(m_original_locale);
|
||||
m_new_locale = newlocale(LC_NUMERIC_MASK, "C", m_new_locale);
|
||||
uselocale(m_new_locale);
|
||||
#else // APPLE
|
||||
m_original_locale = uselocale((locale_t)0);
|
||||
m_new_locale = newlocale(LC_NUMERIC_MASK, "C", m_original_locale);
|
||||
#endif
|
||||
}
|
||||
|
||||
|
|
@ -58,7 +61,6 @@ double string_to_double_decimal_point(const std::string& str, size_t* pos /* = n
|
|||
|
||||
std::string float_to_string_decimal_point(double value, int precision/* = -1*/)
|
||||
{
|
||||
assert(is_decimal_separator_point());
|
||||
std::stringstream buf;
|
||||
if (precision >= 0)
|
||||
buf << std::fixed << std::setprecision(precision);
|
||||
|
|
@ -66,11 +68,6 @@ std::string float_to_string_decimal_point(double value, int precision/* = -1*/)
|
|||
return buf.str();
|
||||
}
|
||||
|
||||
//std::string float_to_string_decimal_point(float value, int precision/* = -1*/)
|
||||
//{
|
||||
// return float_to_string_decimal_point(double(value), precision);
|
||||
//}
|
||||
|
||||
|
||||
} // namespace Slic3r
|
||||
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue