Applied fix for wxGrid::ClearAttrCache (#9712).

git-svn-id: https://svn.wxwidgets.org/svn/wx/wxWidgets/trunk@54564 c3d73ce0-8a6f-49c7-b76d-6d57e0e08775
This commit is contained in:
Stefan Neis
2008-07-09 17:24:48 +00:00
parent 9acbe413f9
commit 1506cc6641

View File

@@ -9944,9 +9944,14 @@ void wxGrid::ClearAttrCache()
{ {
if ( m_attrCache.row != -1 ) if ( m_attrCache.row != -1 )
{ {
wxSafeDecRef(m_attrCache.attr); wxGridCellAttr *oldAttr = m_attrCache.attr;
m_attrCache.attr = NULL; m_attrCache.attr = NULL;
m_attrCache.row = -1; m_attrCache.row = -1;
// wxSafeDecRec(...) might cause event processing that accesses
// the cached attribute, if one exists (e.g. by deleting the
// editor stored within the attribute). Therefore it is important
// to invalidate the cache before calling wxSafeDecRef!
wxSafeDecRef(oldAttr);
} }
} }