From: Vadim Zeitlin Date: Tue, 7 Aug 2001 18:18:17 +0000 (+0000) Subject: fixed unwanted owner data accesses in virtual list ctrl X-Git-Url: https://git.saurik.com/wxWidgets.git/commitdiff_plain/c1c4c5516c6e6567302f8b02444255d2a37ac114?ds=inline fixed unwanted owner data accesses in virtual list ctrl git-svn-id: https://svn.wxwidgets.org/svn/wx/wxWidgets/trunk@11319 c3d73ce0-8a6f-49c7-b76d-6d57e0e08775 --- diff --git a/src/generic/listctrl.cpp b/src/generic/listctrl.cpp index 41a18077cd..e4fc11143e 100644 --- a/src/generic/listctrl.cpp +++ b/src/generic/listctrl.cpp @@ -2417,6 +2417,12 @@ bool wxListMainWindow::HighlightLine( size_t line, bool highlight ) void wxListMainWindow::RefreshLine( size_t line ) { + size_t visibleFrom, visibleTo; + GetVisibleLinesRange(&visibleFrom, &visibleTo); + + if ( line < visibleFrom || line > visibleTo ) + return; + wxRect rect = GetLineRect(line); CalcScrolledPosition( rect.x, rect.y, &rect.x, &rect.y ); @@ -2656,7 +2662,11 @@ void wxListMainWindow::SendNotify( size_t line, if ( point != wxDefaultPosition ) le.m_pointDrag = point; - if ( command != wxEVT_COMMAND_LIST_DELETE_ITEM ) + // don't try to get the line info for virtual list controls: the main + // program has it anyhow and if we did it would result in accessing all + // the lines, even those which are not visible now and this is precisely + // what we're trying to avoid + if ( !IsVirtual() && (command != wxEVT_COMMAND_LIST_DELETE_ITEM) ) { GetLine(line)->GetItem( 0, le.m_item ); }