Don't cache NULL attr objects
git-svn-id: https://svn.wxwidgets.org/svn/wx/wxWidgets/branches/WX_2_4_BRANCH@17978 c3d73ce0-8a6f-49c7-b76d-6d57e0e08775
This commit is contained in:
@@ -3835,6 +3835,8 @@ void wxGrid::Init()
|
|||||||
|
|
||||||
// init attr cache
|
// init attr cache
|
||||||
m_attrCache.row = -1;
|
m_attrCache.row = -1;
|
||||||
|
m_attrCache.col = -1;
|
||||||
|
m_attrCache.attr = NULL;
|
||||||
|
|
||||||
// TODO: something better than this ?
|
// TODO: something better than this ?
|
||||||
//
|
//
|
||||||
@@ -8637,6 +8639,8 @@ void wxGrid::ClearAttrCache()
|
|||||||
}
|
}
|
||||||
|
|
||||||
void wxGrid::CacheAttr(int row, int col, wxGridCellAttr *attr) const
|
void wxGrid::CacheAttr(int row, int col, wxGridCellAttr *attr) const
|
||||||
|
{
|
||||||
|
if ( attr != NULL )
|
||||||
{
|
{
|
||||||
wxGrid *self = (wxGrid *)this; // const_cast
|
wxGrid *self = (wxGrid *)this; // const_cast
|
||||||
|
|
||||||
@@ -8646,6 +8650,7 @@ void wxGrid::CacheAttr(int row, int col, wxGridCellAttr *attr) const
|
|||||||
self->m_attrCache.attr = attr;
|
self->m_attrCache.attr = attr;
|
||||||
wxSafeIncRef(attr);
|
wxSafeIncRef(attr);
|
||||||
}
|
}
|
||||||
|
}
|
||||||
|
|
||||||
bool wxGrid::LookupAttr(int row, int col, wxGridCellAttr **attr) const
|
bool wxGrid::LookupAttr(int row, int col, wxGridCellAttr **attr) const
|
||||||
{
|
{
|
||||||
|
Reference in New Issue
Block a user