Fix assert when destroying wxDataViewCtrl being edited in wxGTK.
If wxDataViewCtrl was destroyed while showing a generic editor, an assert occurred in wxWindowBase dtor as the event handler pushed on it by the editor. Fix this by calling CancelEditing() when the control is destroyed and also fix the crash in CancelEditing() in wxGTK due to recursive calls to FinishEditing(). Closes #12683. git-svn-id: https://svn.wxwidgets.org/svn/wx/wxWidgets/trunk@67612 c3d73ce0-8a6f-49c7-b76d-6d57e0e08775
This commit is contained in:
@@ -728,12 +728,15 @@ bool wxDataViewRendererBase::StartEditing( const wxDataViewItem &item, wxRect la
|
||||
|
||||
void wxDataViewRendererBase::DestroyEditControl()
|
||||
{
|
||||
// Remove our event handler first to prevent it from (recursively) calling
|
||||
// us again as it would do via a call to FinishEditing() when the editor
|
||||
// loses focus when we hide it below.
|
||||
wxEvtHandler * const handler = m_editorCtrl->PopEventHandler();
|
||||
|
||||
// Hide the control immediately but don't delete it yet as there could be
|
||||
// some pending messages for it.
|
||||
m_editorCtrl->Hide();
|
||||
|
||||
wxEvtHandler * const handler = m_editorCtrl->PopEventHandler();
|
||||
|
||||
wxPendingDelete.Append(handler);
|
||||
wxPendingDelete.Append(m_editorCtrl);
|
||||
}
|
||||
@@ -743,8 +746,6 @@ void wxDataViewRendererBase::CancelEditing()
|
||||
if (!m_editorCtrl)
|
||||
return;
|
||||
|
||||
GetOwner()->GetOwner()->GetMainWindow()->SetFocus();
|
||||
|
||||
DestroyEditControl();
|
||||
}
|
||||
|
||||
|
||||
Reference in New Issue
Block a user