fixed uninitialized wxGridCellAttr::m_defGridAttr (patch 491231)
git-svn-id: https://svn.wxwidgets.org/svn/wx/wxWidgets/trunk@13245 c3d73ce0-8a6f-49c7-b76d-6d57e0e08775
This commit is contained in:
@@ -583,9 +583,10 @@ public:
|
|||||||
};
|
};
|
||||||
|
|
||||||
// ctors
|
// ctors
|
||||||
wxGridCellAttr()
|
wxGridCellAttr(wxGridCellAttr *attrDefault = NULL)
|
||||||
{
|
{
|
||||||
Init();
|
Init(attrDefault);
|
||||||
|
|
||||||
// MB: args used to be 0,0 here but wxALIGN_LEFT is 0
|
// MB: args used to be 0,0 here but wxALIGN_LEFT is 0
|
||||||
SetAlignment(-1, -1);
|
SetAlignment(-1, -1);
|
||||||
}
|
}
|
||||||
@@ -664,17 +665,7 @@ private:
|
|||||||
};
|
};
|
||||||
|
|
||||||
// the common part of all ctors
|
// the common part of all ctors
|
||||||
void Init()
|
void Init(wxGridCellAttr *attrDefault = NULL);
|
||||||
{
|
|
||||||
m_nRef = 1;
|
|
||||||
|
|
||||||
m_isReadOnly = Unset;
|
|
||||||
|
|
||||||
m_renderer = NULL;
|
|
||||||
m_editor = NULL;
|
|
||||||
|
|
||||||
m_attrkind = wxGridCellAttr::Cell;
|
|
||||||
}
|
|
||||||
|
|
||||||
// the dtor is private because only DecRef() can delete us
|
// the dtor is private because only DecRef() can delete us
|
||||||
~wxGridCellAttr()
|
~wxGridCellAttr()
|
||||||
|
@@ -1898,9 +1898,24 @@ void wxGridCellBoolRenderer::Draw(wxGrid& grid,
|
|||||||
// wxGridCellAttr
|
// wxGridCellAttr
|
||||||
// ----------------------------------------------------------------------------
|
// ----------------------------------------------------------------------------
|
||||||
|
|
||||||
|
void wxGridCellAttr::Init(wxGridCellAttr *attrDefault)
|
||||||
|
{
|
||||||
|
m_nRef = 1;
|
||||||
|
|
||||||
|
m_isReadOnly = Unset;
|
||||||
|
|
||||||
|
m_renderer = NULL;
|
||||||
|
m_editor = NULL;
|
||||||
|
|
||||||
|
m_attrkind = wxGridCellAttr::Cell;
|
||||||
|
|
||||||
|
SetDefAttr(attrDefault);
|
||||||
|
}
|
||||||
|
|
||||||
wxGridCellAttr *wxGridCellAttr::Clone() const
|
wxGridCellAttr *wxGridCellAttr::Clone() const
|
||||||
{
|
{
|
||||||
wxGridCellAttr *attr = new wxGridCellAttr;
|
wxGridCellAttr *attr = new wxGridCellAttr(m_defGridAttr);
|
||||||
|
|
||||||
if ( HasTextColour() )
|
if ( HasTextColour() )
|
||||||
attr->SetTextColour(GetTextColour());
|
attr->SetTextColour(GetTextColour());
|
||||||
if ( HasBackgroundColour() )
|
if ( HasBackgroundColour() )
|
||||||
@@ -1926,8 +1941,6 @@ wxGridCellAttr *wxGridCellAttr::Clone() const
|
|||||||
|
|
||||||
attr->SetKind( m_attrkind );
|
attr->SetKind( m_attrkind );
|
||||||
|
|
||||||
attr->SetDefAttr(m_defGridAttr);
|
|
||||||
|
|
||||||
return attr;
|
return attr;
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -3616,8 +3629,7 @@ void wxGrid::Create()
|
|||||||
|
|
||||||
m_cellEditCtrlEnabled = FALSE;
|
m_cellEditCtrlEnabled = FALSE;
|
||||||
|
|
||||||
m_defaultCellAttr = new wxGridCellAttr;
|
m_defaultCellAttr = new wxGridCellAttr(m_defaultCellAttr);
|
||||||
m_defaultCellAttr->SetDefAttr(m_defaultCellAttr);
|
|
||||||
|
|
||||||
// Set default cell attributes
|
// Set default cell attributes
|
||||||
m_defaultCellAttr->SetKind(wxGridCellAttr::Default);
|
m_defaultCellAttr->SetKind(wxGridCellAttr::Default);
|
||||||
@@ -8101,19 +8113,20 @@ wxGridCellAttr *wxGrid::GetCellAttr(int row, int col) const
|
|||||||
wxGridCellAttr *wxGrid::GetOrCreateCellAttr(int row, int col) const
|
wxGridCellAttr *wxGrid::GetOrCreateCellAttr(int row, int col) const
|
||||||
{
|
{
|
||||||
wxGridCellAttr *attr = (wxGridCellAttr *)NULL;
|
wxGridCellAttr *attr = (wxGridCellAttr *)NULL;
|
||||||
wxASSERT_MSG( m_table,
|
|
||||||
_T("we may only be called if CanHaveAttributes() returned TRUE and then m_table should be !NULL") );
|
|
||||||
|
|
||||||
attr = m_table->GetAttr(row, col, wxGridCellAttr::Cell );
|
wxCHECK_MSG( m_table, attr,
|
||||||
if ( !attr )
|
_T("we may only be called if CanHaveAttributes() returned TRUE and then m_table should be !NULL") );
|
||||||
{
|
|
||||||
attr = new wxGridCellAttr;
|
attr = m_table->GetAttr(row, col, wxGridCellAttr::Cell);
|
||||||
|
if ( !attr )
|
||||||
|
{
|
||||||
|
attr = new wxGridCellAttr(m_defaultCellAttr);
|
||||||
|
|
||||||
|
// artificially inc the ref count to match DecRef() in caller
|
||||||
|
attr->IncRef();
|
||||||
|
m_table->SetAttr(attr, row, col);
|
||||||
|
}
|
||||||
|
|
||||||
// artificially inc the ref count to match DecRef() in caller
|
|
||||||
attr->IncRef();
|
|
||||||
m_table->SetAttr(attr, row, col);
|
|
||||||
}
|
|
||||||
attr->SetDefAttr(m_defaultCellAttr);
|
|
||||||
return attr;
|
return attr;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
Reference in New Issue
Block a user