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
This commit is contained in:
Vadim Zeitlin 2013-02-09 00:36:02 +00:00
parent e56fee472c
commit e75ceab08c

View File

@ -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(); }