Ensure current cell remains valid when wxGrid table changes

Replacing the table used by the grid could make the current cell
coordinates invalid, resulting in asserts when trying to use it later.
Fix this by calling the same function which was already called when
changing the existing table.

See #23751, #23752.

(cherry picked from commit e570d85164af9a2bb1bf6ebb9a061cda97f1ae56)

Co-authored-by: Vadim Zeitlin <vadim@wxwidgets.org>
This commit is contained in:
Cookielau 2023-09-15 02:08:36 +02:00 committed by Vadim Zeitlin
parent 8df12c6783
commit 89233049ee
2 changed files with 4 additions and 0 deletions

View File

@ -273,6 +273,8 @@ All (GUI):
- Fix undefined behaviour in wxImage::Paste() (aurel32, #23791).
- Fix EVT_PRESS_AND_TAP() event macro definition (Kumazuma, #23819).
- Fix wxFileHistory formatting after calling Load() (Hartwig Wiesmann, #23799).
- Fix wxRichTextCtrl layout in high DPI (mbc-one, Maarten Bent, #23828).
- Ensure current cell stays valid when wxGrid table changes (CookieLau, #23751).
wxGTK:

View File

@ -2975,6 +2975,8 @@ wxGrid::SetTable(wxGridTableBase *table,
InvalidateBestSize();
UpdateCurrentCellOnRedim();
return m_created;
}