MGR: Fix some crash bugs in the code to hide or rearrange columns which can occur when changing locale to a different language.

This commit is contained in:
Charlie Fenton 2015-05-01 03:20:05 -07:00
parent f1e0df4cc4
commit b1332ad67c
4 changed files with 10 additions and 8 deletions

View File

@ -230,6 +230,10 @@ bool CBOINCListCtrl::OnRestoreState(wxConfigBase* pConfig) {
// If the user installed a new vesion of BOINC, new columns may have
// been added that didn't exist in the older version. Check for this.
//
// This will also be triggered if the locale is changed, which will cause
// SetListColumnOrder() to be called again so the wxListCtrl will be set
// up with the correctly labeled columns.
bool foundNewColumns = false;
if (pConfig->Read(wxT("HiddenColumns"), &strHiddenColumns)) {
@ -273,9 +277,6 @@ bool CBOINCListCtrl::OnRestoreState(wxConfigBase* pConfig) {
SetDefaultColumnDisplay();
}
if (m_pParentView->m_iSortColumnID != -1) {
m_pParentView->InitSort();
@ -351,9 +352,10 @@ void CBOINCListCtrl::SetListColumnOrder(wxArrayString& orderArray) {
//
// CBOINCListCtrl::OnRestoreState() may have incorrectly added the column names in
// the new locale as "new" columns, so check against both shownColCount and stdCount.
if (columnIndex < wxMin(shownColCount, stdCount)) {
int limit = wxMin(shownColCount, stdCount);
if (columnIndex < limit) {
SetStandardColumnOrder();
for (columnID=0; columnID<shownColCount; ++columnID) {
for (columnID=0; columnID<limit; ++columnID) {
aOrder[columnID] = columnID;
pView->AppendColumn(columnID);
pView->m_iColumnIndexToColumnID.Add(columnID);

View File

@ -254,7 +254,7 @@ CViewProjects::CViewProjects(wxNotebook* pNotebook) :
// Entries must be in order of ascending Column ID. We initalize
// it here to the default column widths. It is updated by
// CBOINCListCtrl::OnRestoreState() and also when a user resizes
// a column bby dragging the divider between two columns.
// a column by dragging the divider between two columns.
//
m_iStdColWidthOrder.Clear();
m_iStdColWidthOrder.Insert(150, COLUMN_PROJECT);

View File

@ -218,7 +218,7 @@ CViewTransfers::CViewTransfers(wxNotebook* pNotebook) :
// Entries must be in order of ascending Column ID. We initalize
// it here to the default column widths. It is updated by
// CBOINCListCtrl::OnRestoreState() and also when a user resizes
// a column bby dragging the divider between two columns.
// a column by dragging the divider between two columns.
//
m_iStdColWidthOrder.Clear();
m_iStdColWidthOrder.Insert(125, COLUMN_PROJECT);

View File

@ -270,7 +270,7 @@ CViewWork::CViewWork(wxNotebook* pNotebook) :
// Entries must be in order of ascending Column ID. We initalize
// it here to the default column widths. It is updated by
// CBOINCListCtrl::OnRestoreState() and also when a user resizes
// a column bby dragging the divider between two columns.
// a column by dragging the divider between two columns.
//
m_iStdColWidthOrder.Clear();
m_iStdColWidthOrder.Insert(125, COLUMN_PROJECT);