After using toStdString, the string exhibited abnormal behavior.
-
@John-Van
My first thought is that you cannot guarantee the code generated has even written anything into yours2
variable. It's just a local variable and never referenced afterdataStore[r] = s2;
. The code generated might implement this asdataStore[r] = s1.toStdString();
.Put a breakpoint on those lines and step through them. Does anything (the content, not just the size) in
s2
even change? Put in aqDebug()
statement to examine what is ins2
, does that output something different? Passs2
as a parameter to some other function and examine what it passes there, is that correct or wrong? -
@JonB interesting point...making s2 volatile should hopefully tell the compiler to not optimize it out, thus allowing inspection of it's attributes. Hey! a use for poor underappreciated "volatile"!
-
@John-Van
My first thought is that you cannot guarantee the code generated has even written anything into yours2
variable. It's just a local variable and never referenced afterdataStore[r] = s2;
. The code generated might implement this asdataStore[r] = s1.toStdString();
.Put a breakpoint on those lines and step through them. Does anything (the content, not just the size) in
s2
even change? Put in aqDebug()
statement to examine what is ins2
, does that output something different? Passs2
as a parameter to some other function and examine what it passes there, is that correct or wrong?