Always delete the editor when finishing editing in wxDataViewCtrl

We need to delete the editor control even if GetValueFromEditorCtrl() failed
as otherwise we're never going to be able to edit another item again, at least
with the GTK native implementation, which does nothing when starting to edit
an item if an editor control already exists.
This commit is contained in:
Vadim Zeitlin 2015-11-26 00:56:10 +01:00
parent f9d907a1d4
commit 40502651f9

View File

@ -745,9 +745,10 @@ bool wxDataViewRendererBase::FinishEditing()
if (!m_editorCtrl)
return true;
// Try to get the value, normally we should succeed but if we fail, don't
// return immediately, we still need to destroy the edit control.
wxVariant value;
if ( !GetValueFromEditorCtrl(m_editorCtrl, value) )
return false;
const bool gotValue = GetValueFromEditorCtrl(m_editorCtrl, value);
wxDataViewCtrl* dv_ctrl = GetOwner()->GetOwner();
@ -755,6 +756,9 @@ bool wxDataViewRendererBase::FinishEditing()
dv_ctrl->GetMainWindow()->SetFocus();
if ( !gotValue )
return false;
bool isValid = Validate(value);
unsigned int col = GetOwner()->GetModelColumn();