From 1b61975fba2a9df81e8eb9178bc289a3ba12adb6 Mon Sep 17 00:00:00 2001 From: Vadim Zeitlin Date: Mon, 2 Mar 2015 14:36:13 +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. --- src/generic/listctrl.cpp | 7 +++++++ 1 file changed, 7 insertions(+) diff --git a/src/generic/listctrl.cpp b/src/generic/listctrl.cpp index e92374c6a9..2920a9b892 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 )