]> git.saurik.com Git - wxWidgets.git/commitdiff
Applied fix for wxGrid::ClearAttrCache (#9712).
authorStefan Neis <Stefan.Neis@t-online.de>
Wed, 9 Jul 2008 17:24:48 +0000 (17:24 +0000)
committerStefan Neis <Stefan.Neis@t-online.de>
Wed, 9 Jul 2008 17:24:48 +0000 (17:24 +0000)
git-svn-id: https://svn.wxwidgets.org/svn/wx/wxWidgets/trunk@54564 c3d73ce0-8a6f-49c7-b76d-6d57e0e08775

src/generic/grid.cpp

index 4b73fdedf9be3184feafb37a07325f8a48a8a6a3..a0c9646da923d0019532260c6b2aa0d7aa836134 100644 (file)
@@ -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);
     }
 }