Don't crash in generic wxDataViewCtrl if selected column is removed.

git-svn-id: https://svn.wxwidgets.org/svn/wx/wxWidgets/trunk@70308 c3d73ce0-8a6f-49c7-b76d-6d57e0e08775
This commit is contained in:
Václav Slavík
2012-01-09 18:59:23 +00:00
parent f1cfa1132c
commit f52f37959d

View File

@@ -623,6 +623,9 @@ public:
void ChangeCurrentRow( unsigned int row ); void ChangeCurrentRow( unsigned int row );
bool TryAdvanceCurrentColumn(wxDataViewTreeNode *node, bool forward); bool TryAdvanceCurrentColumn(wxDataViewTreeNode *node, bool forward);
wxDataViewColumn *GetCurrentColumn() const { return m_currentCol; }
void ClearCurrentColumn() { m_currentCol = NULL; }
bool IsSingleSel() const { return !GetParent()->HasFlag(wxDV_MULTIPLE); } bool IsSingleSel() const { return !GetParent()->HasFlag(wxDV_MULTIPLE); }
bool IsEmpty() { return GetRowCount() == 0; } bool IsEmpty() { return GetRowCount() == 0; }
@@ -4742,6 +4745,10 @@ bool wxDataViewCtrl::DeleteColumn( wxDataViewColumn *column )
m_colsBestWidths.erase(m_colsBestWidths.begin() + GetColumnIndex(column)); m_colsBestWidths.erase(m_colsBestWidths.begin() + GetColumnIndex(column));
m_cols.Erase(ret); m_cols.Erase(ret);
if ( m_clientArea->GetCurrentColumn() == column )
m_clientArea->ClearCurrentColumn();
OnColumnsCountChanged(); OnColumnsCountChanged();
return true; return true;
@@ -4752,7 +4759,11 @@ bool wxDataViewCtrl::ClearColumns()
SetExpanderColumn(NULL); SetExpanderColumn(NULL);
m_cols.Clear(); m_cols.Clear();
m_colsBestWidths.clear(); m_colsBestWidths.clear();
m_clientArea->ClearCurrentColumn();
OnColumnsCountChanged(); OnColumnsCountChanged();
return true; return true;
} }