From d1b021ffb98f791918093f150b9b38fa0efa0e04 Mon Sep 17 00:00:00 2001 From: Stefan Neis Date: Sun, 15 Jun 2008 17:24:22 +0000 Subject: [PATCH] Fixed problems with reassigning the already assigned attribute, see #9567. git-svn-id: https://svn.wxwidgets.org/svn/wx/wxWidgets/trunk@54244 c3d73ce0-8a6f-49c7-b76d-6d57e0e08775 --- src/generic/grid.cpp | 13 +++++++++---- 1 file changed, 9 insertions(+), 4 deletions(-) diff --git a/src/generic/grid.cpp b/src/generic/grid.cpp index def8868..e021e6b 100644 --- a/src/generic/grid.cpp +++ b/src/generic/grid.cpp @@ -83,10 +83,12 @@ struct wxGridCellWithAttr wxGridCellWithAttr& operator=(const wxGridCellWithAttr& other) { coords = other.coords; - attr->DecRef(); - attr = other.attr; - attr->IncRef(); - + if (attr != other.attr) + { + attr->DecRef(); + attr = other.attr; + attr->IncRef(); + } return *this; } @@ -2766,6 +2768,9 @@ void wxGridRowOrColAttrData::SetAttr(wxGridCellAttr *attr, int rowOrCol) else { size_t n = (size_t)i; + if ( m_attrs[n] == attr ) + // nothing to do + return; if ( attr ) { // change the attribute -- 2.7.4