From: Vadim Zeitlin Date: Tue, 26 Oct 2010 15:11:00 +0000 (+0000) Subject: Compilation fix for wxUSE_UNICODE_WCHAR && !wxUSE_STL_BASED_WXSTRING. X-Git-Url: https://git.saurik.com/wxWidgets.git/commitdiff_plain/bd63e363c263e069521a5629bdff684948469747 Compilation fix for wxUSE_UNICODE_WCHAR && !wxUSE_STL_BASED_WXSTRING. Construct wxScopedWCharBuffer using CreateNonOwned() in wxString::ToStdWstring() in this case, creating it directly from wc_str() doesn't work (intentionally, as this doesn't tell if the buffer owns the string or not). git-svn-id: https://svn.wxwidgets.org/svn/wx/wxWidgets/trunk@65928 c3d73ce0-8a6f-49c7-b76d-6d57e0e08775 --- diff --git a/include/wx/string.h b/include/wx/string.h index cb8d6bccfe..95d440a362 100644 --- a/include/wx/string.h +++ b/include/wx/string.h @@ -1383,7 +1383,13 @@ public: #define wxStringToStdWstringRetType wxStdWideString wxStdWideString ToStdWstring() const { +#if wxUSE_UNICODE_WCHAR + wxScopedWCharBuffer buf = + wxScopedWCharBuffer::CreateNonOwned(m_impl.c_str(), m_impl.length()); +#else // !wxUSE_UNICODE_WCHAR wxScopedWCharBuffer buf(wc_str()); +#endif + return wxStdWideString(buf.data(), buf.length()); } #endif