From: Stefan Neis Date: Wed, 9 Jul 2008 17:24:48 +0000 (+0000) Subject: Applied fix for wxGrid::ClearAttrCache (#9712). X-Git-Url: https://git.saurik.com/wxWidgets.git/commitdiff_plain/1506cc6641867800e11b0bdb6f9df87721d9ddc2 Applied fix for wxGrid::ClearAttrCache (#9712). git-svn-id: https://svn.wxwidgets.org/svn/wx/wxWidgets/trunk@54564 c3d73ce0-8a6f-49c7-b76d-6d57e0e08775 --- diff --git a/src/generic/grid.cpp b/src/generic/grid.cpp index 4b73fdedf9..a0c9646da9 100644 --- a/src/generic/grid.cpp +++ b/src/generic/grid.cpp @@ -9944,9 +9944,14 @@ void wxGrid::ClearAttrCache() { if ( m_attrCache.row != -1 ) { - wxSafeDecRef(m_attrCache.attr); + wxGridCellAttr *oldAttr = m_attrCache.attr; m_attrCache.attr = NULL; 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); } }