ensure m_rowHeightCache is not NULL before accessing it
This commit is contained in:
committed by
Vadim Zeitlin
parent
b2cdd287bb
commit
8c64209df1
@@ -710,7 +710,9 @@ public:
|
|||||||
bool Cleared();
|
bool Cleared();
|
||||||
void Resort()
|
void Resort()
|
||||||
{
|
{
|
||||||
m_rowHeightCache->Clear();
|
if ( m_rowHeightCache )
|
||||||
|
m_rowHeightCache->Clear();
|
||||||
|
|
||||||
if (!IsVirtualList())
|
if (!IsVirtualList())
|
||||||
{
|
{
|
||||||
m_root->Resort(this);
|
m_root->Resort(this);
|
||||||
@@ -2752,7 +2754,7 @@ bool wxDataViewMainWindow::ItemAdded(const wxDataViewItem & parent, const wxData
|
|||||||
}
|
}
|
||||||
else
|
else
|
||||||
{
|
{
|
||||||
if (GetOwner()->HasFlag(wxDV_VARIABLE_LINE_HEIGHT))
|
if ( m_rowHeightCache )
|
||||||
{
|
{
|
||||||
// specific position (row) is unclear, so clear whole height cache
|
// specific position (row) is unclear, so clear whole height cache
|
||||||
m_rowHeightCache->Clear();
|
m_rowHeightCache->Clear();
|
||||||
@@ -2899,7 +2901,7 @@ bool wxDataViewMainWindow::ItemDeleted(const wxDataViewItem& parent,
|
|||||||
return true;
|
return true;
|
||||||
}
|
}
|
||||||
|
|
||||||
if (GetOwner()->HasFlag(wxDV_VARIABLE_LINE_HEIGHT))
|
if ( m_rowHeightCache )
|
||||||
m_rowHeightCache->Remove(GetRowByItem(parent) + itemPosInNode);
|
m_rowHeightCache->Remove(GetRowByItem(parent) + itemPosInNode);
|
||||||
|
|
||||||
// Delete the item from wxDataViewTreeNode representation:
|
// Delete the item from wxDataViewTreeNode representation:
|
||||||
@@ -2966,7 +2968,7 @@ bool wxDataViewMainWindow::DoItemChanged(const wxDataViewItem & item, int view_c
|
|||||||
{
|
{
|
||||||
if ( !IsVirtualList() )
|
if ( !IsVirtualList() )
|
||||||
{
|
{
|
||||||
if (GetOwner()->HasFlag(wxDV_VARIABLE_LINE_HEIGHT))
|
if ( m_rowHeightCache )
|
||||||
m_rowHeightCache->Remove(GetRowByItem(item));
|
m_rowHeightCache->Remove(GetRowByItem(item));
|
||||||
|
|
||||||
// Move this node to its new correct place after it was updated.
|
// Move this node to its new correct place after it was updated.
|
||||||
@@ -3018,7 +3020,9 @@ bool wxDataViewMainWindow::Cleared()
|
|||||||
DestroyTree();
|
DestroyTree();
|
||||||
m_selection.Clear();
|
m_selection.Clear();
|
||||||
m_currentRow = (unsigned)-1;
|
m_currentRow = (unsigned)-1;
|
||||||
m_rowHeightCache->Clear();
|
|
||||||
|
if ( m_rowHeightCache )
|
||||||
|
m_rowHeightCache->Clear();
|
||||||
|
|
||||||
if (GetModel())
|
if (GetModel())
|
||||||
{
|
{
|
||||||
@@ -3348,7 +3352,7 @@ wxRect wxDataViewMainWindow::GetLinesRect( unsigned int rowFrom, unsigned int ro
|
|||||||
int wxDataViewMainWindow::GetLineStart( unsigned int row ) const
|
int wxDataViewMainWindow::GetLineStart( unsigned int row ) const
|
||||||
{
|
{
|
||||||
// check for the easy case first
|
// check for the easy case first
|
||||||
if (!GetOwner()->HasFlag(wxDV_VARIABLE_LINE_HEIGHT))
|
if ( !m_rowHeightCache || !GetOwner()->HasFlag(wxDV_VARIABLE_LINE_HEIGHT) )
|
||||||
return row * m_lineHeight;
|
return row * m_lineHeight;
|
||||||
|
|
||||||
int start = 0;
|
int start = 0;
|
||||||
@@ -3378,7 +3382,7 @@ int wxDataViewMainWindow::GetLineStart( unsigned int row ) const
|
|||||||
int wxDataViewMainWindow::GetLineAt( unsigned int y ) const
|
int wxDataViewMainWindow::GetLineAt( unsigned int y ) const
|
||||||
{
|
{
|
||||||
// check for the easy case first
|
// check for the easy case first
|
||||||
if ( !GetOwner()->HasFlag(wxDV_VARIABLE_LINE_HEIGHT) )
|
if ( !m_rowHeightCache || !GetOwner()->HasFlag(wxDV_VARIABLE_LINE_HEIGHT) )
|
||||||
return y / m_lineHeight;
|
return y / m_lineHeight;
|
||||||
|
|
||||||
unsigned int row = 0;
|
unsigned int row = 0;
|
||||||
@@ -3430,7 +3434,7 @@ int wxDataViewMainWindow::GetLineAt( unsigned int y ) const
|
|||||||
int wxDataViewMainWindow::GetLineHeight( unsigned int row ) const
|
int wxDataViewMainWindow::GetLineHeight( unsigned int row ) const
|
||||||
{
|
{
|
||||||
// check for the easy case first
|
// check for the easy case first
|
||||||
if (!GetOwner()->HasFlag(wxDV_VARIABLE_LINE_HEIGHT))
|
if ( !m_rowHeightCache || !GetOwner()->HasFlag(wxDV_VARIABLE_LINE_HEIGHT) )
|
||||||
return m_lineHeight;
|
return m_lineHeight;
|
||||||
|
|
||||||
int height = 0;
|
int height = 0;
|
||||||
@@ -3613,7 +3617,7 @@ void wxDataViewMainWindow::Expand( unsigned int row )
|
|||||||
if (!node->HasChildren())
|
if (!node->HasChildren())
|
||||||
return;
|
return;
|
||||||
|
|
||||||
if (GetOwner()->HasFlag(wxDV_VARIABLE_LINE_HEIGHT))
|
if ( m_rowHeightCache )
|
||||||
{
|
{
|
||||||
// Expand makes new rows visible thus we invalidates all following
|
// Expand makes new rows visible thus we invalidates all following
|
||||||
// rows in the height cache
|
// rows in the height cache
|
||||||
@@ -3669,7 +3673,7 @@ void wxDataViewMainWindow::Collapse(unsigned int row)
|
|||||||
if (!node->HasChildren())
|
if (!node->HasChildren())
|
||||||
return;
|
return;
|
||||||
|
|
||||||
if (GetOwner()->HasFlag(wxDV_VARIABLE_LINE_HEIGHT))
|
if ( m_rowHeightCache )
|
||||||
{
|
{
|
||||||
// Collapse hides rows thus we invalidates all following
|
// Collapse hides rows thus we invalidates all following
|
||||||
// rows in the height cache
|
// rows in the height cache
|
||||||
|
Reference in New Issue
Block a user