From c4f569ed60f08ecb318c7268c92471cc5d9071a8 Mon Sep 17 00:00:00 2001 From: Vadim Zeitlin Date: Mon, 2 Mar 2015 14:39:45 +0100 Subject: [PATCH] Avoid refreshing not currently visible items in generic wxListCtrl. This is useless at best and resulted in GTK+ warnings because we ended up (somehow -- is there another bug lurking here?) with negative items height in this case. Closes #16862. --- docs/changes.txt | 1 + src/generic/listctrl.cpp | 7 +++++++ 2 files changed, 8 insertions(+) diff --git a/docs/changes.txt b/docs/changes.txt index 66bbbf592e..8885427009 100644 --- a/docs/changes.txt +++ b/docs/changes.txt @@ -597,6 +597,7 @@ wxGTK: target window. - Fix crashes in wxGTK3 when running with non-X11 backend (Marco Trevisan). - Fix coordinates of wxSetCursorEvent propagated to parent windows. +- Fix GTK+ warnings when refreshing wxListCtrl items (Scott Talbert). wxMSW: diff --git a/src/generic/listctrl.cpp b/src/generic/listctrl.cpp index 771c400bb4..d21a8c6fae 100644 --- a/src/generic/listctrl.cpp +++ b/src/generic/listctrl.cpp @@ -1935,6 +1935,13 @@ void wxListMainWindow::RefreshLines( size_t lineFrom, size_t lineTo ) size_t visibleFrom, visibleTo; GetVisibleLinesRange(&visibleFrom, &visibleTo); + if ( lineFrom > visibleTo || lineTo < visibleFrom ) + { + // None of these lines are currently visible at all, don't bother + // doing anything. + return; + } + if ( lineFrom < visibleFrom ) lineFrom = visibleFrom; if ( lineTo > visibleTo )