Version 0.11.1 introduced an issue in ofXml, that leads to random undefined behaviour.
std::locale returns a temporary char*, this is saved in auto loc, but the next line (std::setlocale( LC_NUMERIC, "C" );) invalidates this internal char*, so it should not be used anymore from then on.
But in the line 252 it is used again to reset the locale. This leads to random behaviour down the line as the loc pointer is not valid anymore at that point.
248 float ofXml::getFloatValue() const{
249 auto loc = std::setlocale( LC_NUMERIC, NULL );
250 std::setlocale( LC_NUMERIC, "C" );
251 float f = this->xml.text().as_float();
252 std::setlocale( LC_NUMERIC, loc );
253 return f;
254 }
So this should be changed by saving a deep copy to the char*, maybe like this:
Version 0.11.1 introduced an issue in ofXml, that leads to random undefined behaviour. std::locale returns a temporary
char*
, this is saved inauto loc
, but the next line (std::setlocale( LC_NUMERIC, "C" );
) invalidates this internalchar*
, so it should not be used anymore from then on. But in the line 252 it is used again to reset the locale. This leads to random behaviour down the line as theloc
pointer is not valid anymore at that point.So this should be changed by saving a deep copy to the
char*
, maybe like this:The same change is need in
ofXml::Attribute::getFloatValue
,ofXml::Attribute::getFloatValue
andofXml::Attribute::getFloatValue
as well.This issue was introduced in 6678 that tried to fix 6111