Fix GTK warnings after 4b9485a when TLW is closed while editor is still shown, see #16850

This commit is contained in:
Paul Cornett 2015-04-26 11:01:44 -07:00
parent d13278ecc3
commit f0a2a6472f
2 changed files with 20 additions and 0 deletions

View File

@ -34,6 +34,8 @@ public:
virtual void EnableEllipsize(wxEllipsizeMode mode = wxELLIPSIZE_MIDDLE);
virtual wxEllipsizeMode GetEllipsizeMode() const;
virtual bool FinishEditing() wxOVERRIDE;
// GTK-specific implementation
// ---------------------------

View File

@ -1852,6 +1852,24 @@ wxDataViewRenderer::wxDataViewRenderer( const wxString &varianttype, wxDataViewC
// after the m_renderer pointer has been initialized
}
bool wxDataViewRenderer::FinishEditing()
{
wxWindow* editorCtrl = m_editorCtrl;
bool ret = wxDataViewRendererBase::FinishEditing();
if (editorCtrl && wxGetTopLevelParent(editorCtrl)->IsBeingDeleted())
{
// remove editor widget before editor control is deleted,
// to prevent several GTK warnings
gtk_cell_editable_remove_widget(GTK_CELL_EDITABLE(editorCtrl->m_widget));
// delete editor control now, if it is deferred multiple erroneous
// focus-out events will occur, causing debug warnings
delete editorCtrl;
}
return ret;
}
void wxDataViewRenderer::GtkPackIntoColumn(GtkTreeViewColumn *column)
{
gtk_tree_view_column_pack_end( column, m_renderer, TRUE /* expand */);