Andre Poenitz wrote:
On Thu, May 04, 2006 at 10:05:41AM +0200, Edwin Leuven wrote:
-       Q3CString tmpstr = codec->fromUnicode(str);
-       char const * tmpcstr = tmpstr;
+       char const * tmpcstr = codec->fromUnicode(str).data();
        return tmpcstr[0];
 }

fromUnicode() returns a temporary object that will be destoyed at the
end of the full expression. So tmpcstr will be invalid after that.

Accessing tmpcstr[0] after that will cause invalid behaviour (and almost
guaranteed a crash with the Qt4 equivalent on a VS 2005 release build).

und jetzt?

Reply via email to