Open GoogleCodeExporter opened 8 years ago
This is a user error. "str" (and therefore "*c") is quite likely destroyed,
when you try to read the object again. You need to copy the string, if you
can't guarantee that the contents' lifetime is sufficiently long.
Try to change your code to:
string str = "2";
Value name(str.c_str(), this->_doc->GetAllocator());
changedStatus.AddMember(name, turned_on ? "on" : "off", this->_doc->GetAllocator());
Alternatively, if you really have a constant string "2" here, then you can
safely use:
Value name("2"); // no copy (but constant string literal)
changedstatus.AddMember(name, ...);
hth,
Philipp
Original comment by philipp....@gmail.com
on 2 Nov 2014 at 7:17
Original issue reported on code.google.com by
Fannie.P...@gmail.com
on 1 Nov 2014 at 8:04