From: Vadim Zeitlin Date: Sat, 26 Jan 2008 22:20:45 +0000 (+0000) Subject: fix the code to not use dangling pointers resulting in asserts about invalid Unicode... X-Git-Url: https://git.saurik.com/wxWidgets.git/commitdiff_plain/da603a6786ae42c68b1b8bf31f3d4b1de290b4c0 fix the code to not use dangling pointers resulting in asserts about invalid Unicode strings mentioned in the bug 1880411 git-svn-id: https://svn.wxwidgets.org/svn/wx/wxWidgets/trunk@51388 c3d73ce0-8a6f-49c7-b76d-6d57e0e08775 --- diff --git a/samples/controls/controls.cpp b/samples/controls/controls.cpp index 2ab570ed62..236468c6cb 100644 --- a/samples/controls/controls.cpp +++ b/samples/controls/controls.cpp @@ -1312,11 +1312,10 @@ void MyPanel::OnListBoxButtons( wxCommandEvent &event ) #if wxUSE_CHOICE -static const wxChar *GetDataString(wxClientData *data) +static wxString GetDataString(wxClientData *data) { - return ( - data ? wx_static_cast(wxStringClientData *, data)->GetData() : wxString("none") - ).c_str(); + return data ? wx_static_cast(wxStringClientData *, data)->GetData() + : wxString("none"); } void MyPanel::OnChoice( wxCommandEvent &event ) @@ -1334,8 +1333,8 @@ void MyPanel::OnChoice( wxCommandEvent &event ) _T("data \"%s\"/\"%s\""), (int)event.GetInt(), sel, - event.GetString().c_str(), - choice->GetStringSelection().c_str(), + event.GetString(), + choice->GetStringSelection(), GetDataString(dataEvt), GetDataString(dataCtrl)); }