From c29582d0b0588b5200a60cba433bf6046b8bf5a0 Mon Sep 17 00:00:00 2001 From: Julian Smart Date: Thu, 8 Aug 2002 09:15:03 +0000 Subject: [PATCH] Applied patch [ 590247 ] Fix bad calculation of listctrl update. In wxGenericListCtrl when removing single items a call to RefreshAfter would cause bad things to happen in GTK/X11. It would under certain circumstances put Xlib into an exponential memory and cpu usage mode. Causing eventual core dump but not before using all memory and swap. The problem is that RefreshAfter is passing a negative height rectangle refresh to GTK/X11. This stems from a mixture of using scrolled and unscrolled values to calculate the update region. This patch fixes the problem... by transforming to scrolled values earlier. And also adds one optimization to not update when the item is below the visible area. Tested on GTK. git-svn-id: https://svn.wxwidgets.org/svn/wx/wxWidgets/trunk@16402 c3d73ce0-8a6f-49c7-b76d-6d57e0e08775 --- src/generic/listctrl.cpp | 8 +++++--- 1 file changed, 5 insertions(+), 3 deletions(-) diff --git a/src/generic/listctrl.cpp b/src/generic/listctrl.cpp index ae100c2725..aeee3f956f 100644 --- a/src/generic/listctrl.cpp +++ b/src/generic/listctrl.cpp @@ -2672,22 +2672,24 @@ void wxListMainWindow::RefreshAfter( size_t lineFrom ) { if ( HasFlag(wxLC_REPORT) ) { - size_t visibleFrom; - GetVisibleLinesRange(&visibleFrom, NULL); + size_t visibleFrom, visibleTo; + GetVisibleLinesRange(&visibleFrom, &visibleTo); if ( lineFrom < visibleFrom ) lineFrom = visibleFrom; + else if ( lineFrom > visibleTo ) + return; wxRect rect; rect.x = 0; rect.y = GetLineY(lineFrom); + CalcScrolledPosition( rect.x, rect.y, &rect.x, &rect.y ); wxSize size = GetClientSize(); rect.width = size.x; // refresh till the bottom of the window rect.height = size.y - rect.y; - CalcScrolledPosition( rect.x, rect.y, &rect.x, &rect.y ); RefreshRect( rect ); } else // !report -- 2.47.2