From 00d0a6ccc70124de24f843d1c2ff11598fa394a6 Mon Sep 17 00:00:00 2001 From: Charlie Fenton Date: Thu, 11 Mar 2010 01:14:07 +0000 Subject: [PATCH] MGR: Improve performance when reducing number of rows in lists (as when selecting "Show active tasks") svn path=/trunk/boinc/; revision=20832 --- checkin_notes | 7 +++++++ clientgui/BOINCBaseView.cpp | 9 +++++---- 2 files changed, 12 insertions(+), 4 deletions(-) diff --git a/checkin_notes b/checkin_notes index 02ee6b3f6a..9122940931 100644 --- a/checkin_notes +++ b/checkin_notes @@ -1796,3 +1796,10 @@ David 10 Mar 2010 time_stats.cpp app_control.cpp +Charlie 10 Mar 2010 + - MGR: Improve performance when reducing number of rows in lists (as + when selecting "Show active tasks") by calling ClearSelections() + and SetItemCount() instead of repeatedly calling DeleteItem(). + + clientgui/ + BOINCBaseView.cpp diff --git a/clientgui/BOINCBaseView.cpp b/clientgui/BOINCBaseView.cpp index bfd24343b9..134da81c3c 100644 --- a/clientgui/BOINCBaseView.cpp +++ b/clientgui/BOINCBaseView.cpp @@ -298,11 +298,12 @@ void CBOINCBaseView::OnListRender(wxTimerEvent& event) { m_pListPane->SetItemCount(iDocCount); m_bNeedSort = true; } else { - // We can't just call SetItemCount() here because we need to - // let the virtual ListCtrl adjust its list of selected rows - // to remove (deselect) any beyond the new last row + // The virtual ListCtrl keeps a separate its list of selected rows; + // make sure it does not reference any rows beyond the new last row. + // We can ClearSelections() because we called SaveSelections() above. + ClearSelections(); + m_pListPane->SetItemCount(iDocCount); for (iIndex = (iCacheCount - 1); iIndex >= iDocCount; --iIndex) { - m_pListPane->DeleteItem(iIndex); iReturnValue = RemoveCacheElement(); wxASSERT(!iReturnValue); }