diff --git a/src/generic/listctrl.cpp b/src/generic/listctrl.cpp index 04c2a0d082..7def225918 100644 --- a/src/generic/listctrl.cpp +++ b/src/generic/listctrl.cpp @@ -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 ); diff --git a/src/generic/treectlg.cpp b/src/generic/treectlg.cpp index 6e49cdf008..ab545554c9 100644 --- a/src/generic/treectlg.cpp +++ b/src/generic/treectlg.cpp @@ -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 );