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
This commit is contained in:
parent
5ac7be7a9f
commit
c29582d0b0
@ -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
|
||||
|
Loading…
Reference in New Issue
Block a user