From 31a10d0355bbeb3398d777a5dafc7c40a31076d0 Mon Sep 17 00:00:00 2001 From: Vadim Zeitlin Date: Mon, 30 Nov 2015 03:59:05 +0100 Subject: [PATCH] Fix editing items with custom renderers in wxGTK wxDataViewCtrl Call FinishEditing() when the cell is done being edited instead of sending wxEVT_DATAVIEW_ITEM_EDITING_DONE event manually from wxGTK code. This fixes the bug with not being able to edit an item the second time if the editor was dismissed by GTK+ itself and not by our own code (which already did call FinishEditing()) as the old editor still remained alive because DestroyEditControl(), usually called from FinishEditing(), wasn't executed. It also removes code duplication and avoids the need to keep a global s_user_data pointer as the item currently being edited is already stored in wxDataViewRenderer anyhow. --- src/gtk/dataview.cpp | 13 +------------ 1 file changed, 1 insertion(+), 12 deletions(-) diff --git a/src/gtk/dataview.cpp b/src/gtk/dataview.cpp index 0e93eeda0a..1a309ba5f4 100644 --- a/src/gtk/dataview.cpp +++ b/src/gtk/dataview.cpp @@ -1742,20 +1742,11 @@ bool wxGtkDataViewModelNotifier::Cleared() // wxDataViewRenderer // --------------------------------------------------------- -static gpointer s_user_data = NULL; - static void wxgtk_cell_editable_editing_done( GtkCellEditable *WXUNUSED(editable), wxDataViewRenderer *wxrenderer ) { - wxDataViewColumn *column = wxrenderer->GetOwner(); - wxDataViewCtrl *dv = column->GetOwner(); - wxDataViewEvent event( wxEVT_DATAVIEW_ITEM_EDITING_DONE, dv->GetId() ); - event.SetDataViewColumn( column ); - event.SetModel( dv->GetModel() ); - wxDataViewItem item( s_user_data ); - event.SetItem( item ); - dv->HandleWindowEvent( event ); + wxrenderer->FinishEditing(); } static void @@ -1772,8 +1763,6 @@ wxgtk_renderer_editing_started( GtkCellRenderer *WXUNUSED(cell), GtkCellEditable if (GTK_IS_CELL_EDITABLE(editable)) { - s_user_data = item.GetID(); - g_signal_connect (editable, "editing_done", G_CALLBACK (wxgtk_cell_editable_editing_done), (gpointer) wxrenderer );