diff --git a/checkin_notes b/checkin_notes index 36b4b63d3e..0e4e465ef8 100644 --- a/checkin_notes +++ b/checkin_notes @@ -629,6 +629,12 @@ David 22 Jan 2009 Charlie Jan 22 2009 - client sandbox: add details in switcher_exec "execv failed" message. + - MGR: Work around bug in generic list control GetSelectedItemCount() + which caused incorrect update of buttons in Projects tab after + detching from a project; remove redundant UpdateSelection() call. client/ sandbox.cpp + clientgui/ + BOINCBaseView.cpp + BOINCListCtrl.cpp,.h diff --git a/clientgui/BOINCBaseView.cpp b/clientgui/BOINCBaseView.cpp index 5532622dd4..1586b05851 100644 --- a/clientgui/BOINCBaseView.cpp +++ b/clientgui/BOINCBaseView.cpp @@ -318,7 +318,7 @@ void CBOINCBaseView::OnListRender(wxTimerEvent& event) { // Find the previously selected items by their key values and reselect them RestoreSelections(); - UpdateSelection(); +// UpdateSelection(); // This was called by RestoreSelections() if needed m_bProcessingListRenderEvent = false; } diff --git a/clientgui/BOINCListCtrl.cpp b/clientgui/BOINCListCtrl.cpp index 88811e7c54..64e0a6e70c 100644 --- a/clientgui/BOINCListCtrl.cpp +++ b/clientgui/BOINCListCtrl.cpp @@ -409,6 +409,19 @@ void MyEvtHandler::OnPaint(wxPaintEvent & event) } } +// Work around a bug in generic list control which doesn't +// adjust count when a selected item is deleted +int CBOINCListCtrl::GetSelectedItemCount() { + + int i = -1, n = 0; + while (1) { + i = GetNextSelected(i); + if (i < 0) break; + n++; + } + return n; +} + #endif diff --git a/clientgui/BOINCListCtrl.h b/clientgui/BOINCListCtrl.h index f396ba9970..768088de9c 100644 --- a/clientgui/BOINCListCtrl.h +++ b/clientgui/BOINCListCtrl.h @@ -91,6 +91,7 @@ private: void DrawProgressBars(void); wxScrolledWindow* GetMainWin(void) { return (wxScrolledWindow*) m_mainWin; } wxCoord GetHeaderHeight(void) { return m_headerHeight; } + int GetSelectedItemCount(); #endif };