From 13e1b384e79ce3f189689a7c0d92591b28a83e99 Mon Sep 17 00:00:00 2001 From: Vadim Zeitlin Date: Tue, 30 Jun 2020 19:15:15 +0200 Subject: [PATCH] Fix another possible bug in wxEVT_GRID_CELL_CHANGED handling Even when wxEVT_GRID_CELL_CHANGED is really vetoed, it's still possible that m_currentCellCoords was changed by the handler, so use the row/col coordinates of the cell that was really changed instead of the possibly different m_currentCellCoords value to avoid a bug similar to the one fixed by the previous commit. --- src/generic/grid.cpp | 6 +++++- 1 file changed, 5 insertions(+), 1 deletion(-) diff --git a/src/generic/grid.cpp b/src/generic/grid.cpp index 456df38029..3db97e21f9 100644 --- a/src/generic/grid.cpp +++ b/src/generic/grid.cpp @@ -7531,7 +7531,11 @@ void wxGrid::DoSaveEditControlValue() if ( SendEvent(wxEVT_GRID_CELL_CHANGED, oldval) == Event_Vetoed ) { // Event has been vetoed, set the data back. - SetCellValue(m_currentCellCoords, oldval); + // + // Note that we must use row and col here, which are sure to + // not have been changed, while m_currentCellCoords could have + // been changed by the event handler. + SetCellValue(row, col, oldval); } } }