// NOTE: use wxTmemcpy() instead of wxStrncpy() to allow
// retrieval of strings with embedded NULLs
wxTmemcpy(static_cast<wxChar*>(buf),
- textNative.c_str(),
- (textNative.length() + 1)*sizeof(wxChar));
+ textNative.t_str(),
+ textNative.length() + 1);
return true;
}
size_t wxHTMLDataObject::GetDataSize() const
{
- const wxScopedCharBuffer buffer(GetHTML().utf8_str());
+ // Ensure that the temporary string returned by GetHTML() is kept alive for
+ // as long as we need it here.
+ const wxString& htmlStr = GetHTML();
+ const wxScopedCharBuffer buffer(htmlStr.utf8_str());
size_t size = buffer.length();
return false;
// Windows and Mac always use UTF-8, and docs suggest GTK does as well.
- const wxScopedCharBuffer html(GetHTML().utf8_str());
+ const wxString& htmlStr = GetHTML();
+ const wxScopedCharBuffer html(htmlStr.utf8_str());
if ( !html )
return false;