Copy wxCommandEvent string explicitly in its copy ctor.
Due to the optimization used in wxCommandEvent::GetString(), which returns the string from the text control that generated the event only if it's really needed, wxCommandEvent::m_cmdString field may be empty even when it does have an associated string. As we lose the possibility to retrieve the value on demand from wxTextCtrl when we make a copy (because it can be associated with a different object), we need to explicitly copy the string to avoid losing this data entirely. This fixes GetString() value for the text events generated by generic wxSearchCtrl. git-svn-id: https://svn.wxwidgets.org/svn/wx/wxWidgets/trunk@72647 c3d73ce0-8a6f-49c7-b76d-6d57e0e08775
This commit is contained in:
parent
8d489a5e4b
commit
34af6cfc8d
@ -1295,7 +1295,12 @@ public:
|
||||
wxEventBasicPayloadMixin(event),
|
||||
m_clientData(event.m_clientData),
|
||||
m_clientObject(event.m_clientObject)
|
||||
{ }
|
||||
{
|
||||
// Because GetString() can retrieve the string text only on demand, we
|
||||
// need to copy it explicitly.
|
||||
if ( m_cmdString.empty() )
|
||||
m_cmdString = event.GetString();
|
||||
}
|
||||
|
||||
// Set/Get client data from controls
|
||||
void SetClientData(void* clientData) { m_clientData = clientData; }
|
||||
|
Loading…
Reference in New Issue
Block a user