From e75ceab08ca0f3ed40931a42e623f770ea6da427 Mon Sep 17 00:00:00 2001 From: Vadim Zeitlin Date: Sat, 9 Feb 2013 00:36:02 +0000 Subject: [PATCH] Fix infinite loop in wxGrid::PosToEdgeOfLine(). Return -1 from wxGridRowOperations::GetLineBefore(0) to ensure that we exit the loop in wxGrid::PosToEdgeOfLine(). Doing this is the logical thing to do as wxGridColumnOperations::GetLineBefore() already behaved like this and this was is more expected than returning 0, as the function previously did for some reason. Closes #15035. git-svn-id: https://svn.wxwidgets.org/svn/wx/wxWidgets/trunk@73487 c3d73ce0-8a6f-49c7-b76d-6d57e0e08775 --- include/wx/generic/private/grid.h | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/include/wx/generic/private/grid.h b/include/wx/generic/private/grid.h index 921aea39d4..3b21325aa0 100644 --- a/include/wx/generic/private/grid.h +++ b/include/wx/generic/private/grid.h @@ -553,7 +553,7 @@ public: // NB: As GetLineAt(), currently this is always identity for rows. virtual int GetLinePos(const wxGrid *grid, int line) const = 0; - // Return the index of the line just before the given one. + // Return the index of the line just before the given one or wxNOT_FOUND. virtual int GetLineBefore(const wxGrid* grid, int line) const = 0; // Get the row or column label window @@ -626,7 +626,7 @@ public: { return line; } // TODO: implement row reordering virtual int GetLineBefore(const wxGrid* WXUNUSED(grid), int line) const - { return line ? line - 1 : line; } + { return line - 1; } virtual wxWindow *GetHeaderWindow(wxGrid *grid) const { return grid->GetGridRowLabelWindow(); } -- 2.47.2