wxListTextCtrlWrapper::Finish and wxTreeTextCtrl::Finish cannot be called multiple times without crashing. wxListTextCtrlWrapper already used to protect against this in the past, but revision 51150 removed the safety check.
This patch reimplements the functionality in a slighly different way for both controls, so that Finish is not called multiple times. git-svn-id: https://svn.wxwidgets.org/svn/wx/wxWidgets/trunk@76809 c3d73ce0-8a6f-49c7-b76d-6d57e0e08775
This commit is contained in:
parent
e154a0a308
commit
a2414fa1b7
@ -1420,6 +1420,13 @@ wxListTextCtrlWrapper::wxListTextCtrlWrapper(wxListMainWindow *owner,
|
||||
|
||||
void wxListTextCtrlWrapper::EndEdit(EndReason reason)
|
||||
{
|
||||
if( m_aboutToFinish )
|
||||
{
|
||||
// We already called Finish which cannot be called
|
||||
// more than once.
|
||||
return;
|
||||
}
|
||||
|
||||
m_aboutToFinish = true;
|
||||
|
||||
switch ( reason )
|
||||
@ -1525,6 +1532,7 @@ void wxListTextCtrlWrapper::OnKillFocus( wxFocusEvent &event )
|
||||
{
|
||||
if ( !m_aboutToFinish )
|
||||
{
|
||||
m_aboutToFinish = true;
|
||||
if ( !AcceptChanges() )
|
||||
m_owner->OnRenameCancelled( m_itemEdited );
|
||||
|
||||
|
@ -458,6 +458,13 @@ wxTreeTextCtrl::wxTreeTextCtrl(wxGenericTreeCtrl *owner,
|
||||
|
||||
void wxTreeTextCtrl::EndEdit(bool discardChanges)
|
||||
{
|
||||
if ( m_aboutToFinish )
|
||||
{
|
||||
// We already called Finish which cannot be called
|
||||
// more than once.
|
||||
return;
|
||||
}
|
||||
|
||||
m_aboutToFinish = true;
|
||||
|
||||
if ( discardChanges )
|
||||
@ -555,6 +562,7 @@ void wxTreeTextCtrl::OnKillFocus( wxFocusEvent &event )
|
||||
{
|
||||
if ( !m_aboutToFinish )
|
||||
{
|
||||
m_aboutToFinish = true;
|
||||
if ( !AcceptChanges() )
|
||||
m_owner->OnRenameCancelled( m_itemEdited );
|
||||
|
||||
|
Loading…
Reference in New Issue
Block a user